Computer Science, asked by tanishk460, 9 hours ago

Write a program to enter 2 number a and b.If a is greater calculate ato the power b otherwise calculate b to the power a.​

Answers

Answered by samarthkrv
1

Answer:

import java.lang.Math;

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

 Scanner sc = new Scanner(System.in);

 System.out.println("Enter 2 numbers");

 int a = sc.nextInt();

 int b = sc.nextInt();

     if(a > b){

         System.out.println(Math.pow(a,b));

     }

     else{

         System.out.println(Math.pow(b,a));

     }

}

}

Explanation:

Similar questions