JAVA - 3
JAVA - 3
Description
● You are given two numbers, stored in variables with the namesnum1andnum2
After this operation is performed, another number, stored in a variable with namenum3is added to num1.
After this, print the result of the following operation again
num1 > num2, this prints true if num1 is greater than num2, else it prints
false
●
Input
● The first and the only line of input contains the values stored in num1, num2 and num3
Output
Sample Input 1
4 8 5
Sample Output 1
false
true
Hint
In the sample test case, the value stored innum1 = 4, while the value stored innum2 = 8. The result of
the operation
num1 > num2, such that 4 is not greater than 8, so the output is false
After this step, the value stored innum3 = 5, is added to num1, so the value stored in num1 becomesnum1
= num1 + num3 = 4 + 5 = 9
num1 > num2, such that 9 is greater than 8, is true, so the output is true the second
time
● You are given two numbers stored in two variables, with the name,num1andnum2
● You have to print the result of three operations in the order as shown above
Input
● The first and the only line of input contains the values stored innum1andnum2
Output
Sample Input 1
4 16
Sample Output 1
false
true
false
Hint
In the sample test case, the value stored innum1 = 4and value stored innum2 = 16
In the first operationnum1 > num2, 4 is not greater than 16, so we get the output asfalse
In the second operationnum1 < num24 is lesser than 16, so we get the output astrue
In the third operationnum1 == num2, num1 is not equal to num2, so we get the output asfalse
You are given five numbers, stored in the variables with the following name
one, two, three, four, five
●
● You have to declare another variablesum1, such thatsum1 = one + two + three
● Also, you have to declare another variablesum2, such thatsum2 = four + five
Input
The first and the only line of input contains the values stored inone, two, three, four, five
Output
Print the result of the operation, after finding the values ofsum1andsum2, as explained in the problem
statement
Sample Input 1
1 2 3 4 5
Sample Output 1
false
Hint
In the sample test case, the values stored in the variables isone = 1, two = 2, three = 3, four =
4, five = 5
Now, the result of the operationsum1 > sum2will be false, assum1 = 4is not greater thansum2 = 5.
You are given seven numbers, stored in the variable with the following names
a,b,c,d,e,f,g
●
(d + e + f + g)
Input
The first and the only line of input contains the seven numbers stored in the variable with the
namesa,b,c,d,e,f,g
Output
Sample Input 1
1 2 3 4 5 6 7
Sample Output 1
false
Hint
In the sample test case, the value stored in the variables is as follows
= (3) * 3 = 9
Similarly, the value of sum2, as explained in the problem statement will besum2 = (d + e + f + g) =
(4 + 5 + 6 + 7) = 22
The operationsum1 > sum2will print false, as the value of sum2 is greater than sum1, hence the output
false
You are given the sides of the rectangle 1: L1 and B1 and sides of the rectangle 2 : L2 and B2.
Input
The first line of each test case contains two space-separated integers L1, B1, L2, B2 , the length and
Constraints
Output
Print(Area of rectangle 1 > Area of rectangle 2)
Sample Input 1
1 2 2 3
Sample Output 1
false
false
You are given two numbers n and m, you need to check if cube of n is greater than square of m.
Input
Output
Sample Input 1
2 3
Sample Output 1
false
Hint
In the given sample test case n = 2 and m = 3 , so cube of n is 2*2*2 =8 and square of m is 3*3 = 9
7.Divisible by 4 Ended
Description
You are given a number, stored in the variable with the nameN
Input
N < 100000
Output
Sample Input 1
12
Sample Output 1
Yes
You are given a number, stored in a variable with the nameN. Check if the the number is divisible by 3 or
not
Hint : A number can be divided into 3 parts, if the number is completely divisible
by 3, that is, the answer of the operation number % 3 is zero
Input
Input Format :
Constraints :
N < 1000
Output
Sample Input 1
6
Sample Output 1
Yes
You are given two numbers, stored in variables with the following names
Australia, England
Input
Input Format :
First and the only line contains 2 space separated integers denoting scores of Australia and England
respectively.
Constraints :
Output
Output one string(either Australia or England) which is the name of Winning team
Sample Input 1
46 67
Sample Output 1
England
You are given a number, stored in the variable with the nameN
If the number is divisible by 2, the number is consideredEven, else the number is consideredOdd
Input
Input Format
Constraints
integer > 1
Output
Output Format
Sample Input 1
5
Sample Output 1
Odd
You are given two numbers stored in the variable with the names
distance, time
speed = distance/time
else
print "Keep Going"
Input
Input Format
First line contains 2 space separated integers where the first integer represents the distance travelled by
Constraints
Output
Sample Input 1
100 2
Sample Output 1
Apply Brake
You are given two numbers, stored in the variable with the following names
fuel, distance
required = fuel*distance
If the value ofrequiredis greater than 50, printEnough, else printGo On
Input
Input Format
The first and the only line of input contains two values, stored in variablesfuel, distance
Constraints
Output
Output the correct statement based on the conditions mentioned in the problem statement.
Sample Input 1
1 46
Sample Output 1
Go On
Hint
In the sample test case, the value stored infuel = 1, and the value stored indistance = 46
Therefore, the value ofrequired = fuel * distance = 1 * 46 = 46, which is less than 50, hence
the outputGo On