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 does it mean to flush a file?

1045


Can you make a constructor final?

1018


Why is the type for real numbers called double?

949


What are the 7 types of characters?

1058


What is float in java?

971


what methods would you overwrite in java.lang.object class?

987


How can we make copy of a java object?

1124


What is a locale?

1125


What are different types of constants?

1023


What is the full form of jpeg?

941


Can a abstract class be declared final?

981


How do I get the | symbol on my keyboard?

1066


What is fail first in java?

1163


What is int argc char * argv?

1131


Distinguish between a predicate and a function?

976