Computer Science, asked by lynnawesome77, 1 year ago

write a menu driven java program for calculating
a)whether the number is even or odd
b)whether it is divisible 11
Is it appropriate to use If-else and nested if to write this program

Answers

Answered by Anonymous
2

Explanation:

Answer for part (a)

Program :

class PROG

{

void main (int n)

{

if (n%2 ==0)

System.out.println("The number is even");

else

System.out.println("The number is odd");

}

}

Answer for part (b)

PROGRAM :

class PROG2

{

void main(int n)

{

if (n%11==0)

System.out.println("Its divisible by 11");

else

System.out.println("Not divisible by 11");

}

}

THESE WERE THE PROGRAMS

Hope this helped you.

Please mark my answer as brainliest if you found it useful.

Thanks.

Similar questions