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 |
What do you mean by jjs in java8?
explain System.out.println
107 Answers Calpine Technologies, Care, Cognizant, CTS, IBM, IBS, LibSys, Oracle, Spiro Solutions, TCS,
we cannot create an object of interface but we can create a variable of it
what is bytecode? watz the difference between machine code and bytecode?
who can i handle multiple client in RMI
How to optimize the javac output?
Which programming language is best in future?
What do you understand by a Static Variable?
What are the difference between composition and inheritance in java?
How to make a write-only class in java?
How many decimal digits is 64 bit?
What is square root in java?