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 do we declare a class static?
What are singleton services?
What is static import?
What invokes a thread's run() method in java programming?
What is a resource leak ?
y cant i declare method like public final static show()
How can you say HashMap is syncronized?
difference between String a; and String a=new String();? y do v need to assign memory to the variable?
Explain the private field modifier?
what is the need of the Ajax?
Is null in java?
What causes memory leak in java?