You are on page 1of 2

APNA

COLLEGE

CONDITIONAL STATEMENTS QUESTIONS

Question 1: Write a Java program to get a number from the user and print whether it is

positive or negative.

t
bo
Question 2: Finish the following code so that it prints You have a feverif your temperature
is above 100 and otherwise prints You don't have a fever.

ubliC class Solution t

h_
public static void main (String[l args) {

double temp = 103.5;

tc
DN
Question 3: Write a Java program to input week number(1-7) and print day of week name
ba
using switch case.

COLLE
Question 4: What will be the value of x & y in the following program:
a

public class Solution


publicstatic void main (String args[])
ph

int a = 63, b = 36;

boolean x= (a <b) ? true : false;

int y= (a > b )
?a b;
al
@

Question Write a Java program that takes a year from the user and print whether that
5:
year is a leap year or not.

Hint:
APNA
COLLEGEE

IS year IS year IS year


divisible Yes divisible Yes divisible Leap Year
by 4? by 100? by 400 ?

No No NO

t
Not a Leap Year Leap Year Not a Leap Year

bo
h_
tc
APNA
ba

COLLEGE
a
ph
al
@

You might also like