2Write a Program Which Will Input an int value xand compute

2.Write a Program Which Will Input an int value x,and compute and output the values of 2 power x and x power 10 as int values.?

Solution

Answer:

import java.util.*;
import java.lang.*;
import java.io.*;
class FindPowerExample {

public static void main(String[] args) {

int x;
Scanner in = new Scanner(System.in);
System.out.println(\"Enter an x value integer\");
x = in.nextInt();

System.out.println(Math.pow(2,x));

System.out.println(Math.pow(x,10));
}
}

2.Write a Program Which Will Input an int value x,and compute and output the values of 2 power x and x power 10 as int values.?SolutionAnswer: import java.util.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site