Fill in the blanks to print "you rock!" if variable "a" is greater than 15, and variable "b" is less than or equal to 72. int a = 144; int b = 33; if (a > 15 b <= ) { system.out.println("you rock!"); }
Answers
Answered by
3
Here, "You rock!" must be displayed if
a > 15 AND b≤72
Program:
int a = 144;
int b = 33;
if(a>15 && b<=72)
{
system.out.println("you rock!");
}
Answered by
1
In the given code of program, two integer type variables are initialized as ‘a’ and ‘b’. ‘a’ is assigned a value 144 and ‘b’ is assigned a value 33.
In the ‘if’ condition ‘a’ is being checked whether it is greater than 15 or not and ‘b’ is being checked whether it is less than or equal to 72 or not. The ‘&&’ conditional operator checks whether both the conditions are true or not. It will only execute when both the conditions are true. In this code, both the conditions true, and hence the ‘if’ condition will execute.
There is a print statement in the ‘if’ condition. Hence, the output will be: you rock.
Similar questions
Social Sciences,
7 months ago
Math,
7 months ago
Chemistry,
1 year ago
Computer Science,
1 year ago
Physics,
1 year ago
Economy,
1 year ago