PROGRAM TO INPUT A NO. . IF THE NO, IS EVEN PRINT ITS SQUARE OTHERWISE PRINT ITS CUBE
Answers
Answered by
5
Hey there !
The answer for your question for JAVA (not with Scanner class) is as follows :-
class abc
{
void main(int n)
{
if (n%2 == 0)
System.out.println("The number is even. It's square is " + (n*n));
else
System.out.println("The number is odd. It's cube is " + (n*n*n))
}
}
Hope it helps :-)
harindersaini2pcf8vf:
Please mark as brainliest if it really helped...please...please
Answered by
3
public class evorod
{
public static void main (int n)
{
if (n%2==0)
System.out.println("No is even. Square is=" +(n*n));
else
System.out.println("No is odd. Cube is ="(n*n*n));
}
}
This is the answer
Similar questions