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 |
Is main is a keyword?
How dead lock situation occurs in java and how you can identify it?
Name the methods in mouse listeners ?
can we override the main() method in java????
3 Answers Vimukti Technologies,
Which collection allows duplicate values in java?
How does hashset work in java?
What is the benefit of inner / nested classes ?
What is a numeric literal?
What are parameters in a method?
What is the purpose of javac exe?
How to instantiate static nested classes in java?
What is the implementation of destroy method in java. Is it native or java code?