HackerRank Solution :: 30 Days Of Code – 3.Intro to Conditional Statements

Objective In this challenge, we’re getting started with conditional statements. Check out the Tutorial tab for learning materials and an instructional video! Task Given an integer, n, perform the following conditional actions: If n is odd, print Weird If n is even and in the inclusive range of 2 to 5,… Read More »HackerRank Solution :: 30 Days Of Code – 3.Intro to Conditional Statements

HackerRank Solution :: 30 Days Of Code – 2.Operators

ObjectiveIn this challenge, you’ll work with arithmetic operators. Check out the Tutorial tab for learning materials and an instructional video! TaskGiven the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as tip), and tax percent (the percentage of the meal price being added as tax) for a meal,… Read More »HackerRank Solution :: 30 Days Of Code – 2.Operators

Demonstrate concept of Arithmetic & Bitwise Operators with a java program. Operands to be considered as per the operators entered by the user.

The below program performs arithmetic and bitwise operations based on number entered by user. Scanner class is used to take input from the user, which is inside java.util.Scanner  class. System.in is used to use input classes. Example import java.util.Scanner; class ArithmeticOperation { //arithmetic operation on… Read More »Demonstrate concept of Arithmetic & Bitwise Operators with a java program. Operands to be considered as per the operators entered by the user.

Write a Java program to get particulars of his/her birthday and display it as shown below. Use 3 variables to hold date, month and year.

In this we are taking date, month and year with three different variable and then check whether the date is valid or not. The below program shows how to check whether the data value is valid or not. Example import java.util.*; class GetBirthDate { //get… Read More »Write a Java program to get particulars of his/her birthday and display it as shown below. Use 3 variables to hold date, month and year.

Justify the following statement in the context of Java. “ boolean can be true (Non-zero) or false(Zero)”.

In java boolean datatype is used to take value true or false.  This is the type that is returned by all relational operators, as in the case a<b. boolean is also required by conditional expressions that govern the control statement such as if and for.… Read More »Justify the following statement in the context of Java. “ boolean can be true (Non-zero) or false(Zero)”.