Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write a program that takes a 5 digit number and calculates
2 power
that number and prints it.

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is t in parametric equations?

942


What are disadvantages of java?

958


What differences exist between iterator and listiterator?

990


Which programming language is best in future?

890


How many JVMs can run on a single machine and what is the meaning of Just-In-Time (JIT) compiler?

1338


What is the difference between an argument and a parameter?

949


Explain about the dynamic behavior of core java?

1069


What is the this keyword?

978


What does the @override annotation do?

965


Can a constructor be made final?

1050


Explain the use of shift operator in java. Can you give some examples?

914


How do you check if two strings are equal in java?

969


what is the difference between preemptive scheduling and time slicing? : Java thread

973


What is static in java?

1020


How do I run java on windows?

1089