Write a Java program to enter two unequal numbers. If the first number is greater , then display the square of the smaller number and cube of the greater number otherwise vice-versa. If the numbers are equal , display message "BOTH NUMBERS ARE EQUAL"
give the answer with input and output
Answers
Answered by
0
Explanation:
import java.util.Scanner;
public class EqualNumber
{
public static void main(String[] args)
{
int n;
Scanner sc = new Scanner(System.in);
System.out.print("Enter a number=");
n = sc.nextInt();
if (n == 10)
{
System.out.println("n is equal to 10.");
}
}
}
Output:
Enter a number=10
n is equal to 10.
Similar questions