Computer Science, asked by shilpajain18, 11 months ago

write a program to enter a numbercalculate and print if the number is even than calculate square other cube​

Answers

Answered by mn121
0

import java.util.*;

public class number

{

public static void main(String args[])

{

Scanner in = new Scanner(System.in);

int n;

System.out.println("Enter a number = ");

n=in.nextInt();

if(n%2==0)

System.out.println(n*n);

else

System.out.println(n*n*n);

}

}

Similar questions