Write a program that takes a 5 digit number and calculates
2 power
that number and prints it.
Answer / r.dhanunjay
import java .io.*;
public class Digits {
public static void main(String[] args) throws IOException
{
try
{
System.out.println("Enter the number with 5 didgits");
BufferedReader br= new BufferedReader(new
InputStreamReader( System.in));
String str = br.readLine();
int i =Integer.parseInt(str);
int j =String.valueOf(i).length();
if(j==5)
{
double k =Math.pow(i,2);
System.out.println(k);
}
else
{
System.out.println("enter only 5 didgits number");
}
}
catch(IOException e)
{
System.err.println();
}
}
}
| Is This Answer Correct ? | 7 Yes | 0 No |
Why char array is favored over string for the storage of passwords?
What are the core java topics?
What is a buffer in java?
What is the difference between overriding & overloading?
How the threads are synchronized?
What is the platform?
What is token in java?
Implement two stacks using a single array.
What is the static import?
Outline the major features of java.
Is java a super set of javascript?
how jvm allocates memory for stack?