0% found this document useful (0 votes)
18 views1 page

Practical 3 Java

The document provides a Java program that demonstrates the use of if statements to determine whether a number is even or odd. It utilizes the Scanner class to take user input and checks the number using a conditional statement. The program outputs whether the entered number is even or odd based on the condition evaluated.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Practical 3 Java

The document provides a Java program that demonstrates the use of if statements to determine whether a number is even or odd. It utilizes the Scanner class to take user input and checks the number using a conditional statement. The program outputs whether the entered number is even or odd based on the condition evaluated.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Practical- No: 3

Write programs to demonstrate use of: if statements (all forms

of if statement Switch – Case statement Different


CODE:

import [Link];

class EO

public static void main( String args[])

Scanner scanner = new Scanner( Syste m.i n); Syste m. out.

pri ntl n("Ent er The Nu mber ="); i nt num= scanner.

nextI nt();

if( num % 2 == 0)

System. out. println( num +" is even");

} else

[Link]( num +" is odd");

You might also like