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 we cannot override static method?
Is there any tag in htm to upload and download files?
hi am an engineering student and my next plan is for ms in either in us or australia i got my passport but i dont know anything bout visa can u give brief idea 1)How to get prepared for visa and 2)How to apply for top universities and 3)How to pay the fee and so on These all are basic questions plz give me a clear idea
can we create object for static class in java
14 Answers IAP Company, IBM, Marlabs, mPortal, TCS,
What is the difference between overriding and overloading in OOPS.
0 Answers Axtria, ITC Indian Tobacco Company,
What is thread synchronization in java?
What best practices should you follow while writing multithreaded code in java?
Explain tree set and its features?
enlist some features of jdk.
Difference between Linked list and Queue?
Can you make a constructor final?
What is difference between adapter class and listener?