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 package private scope in java?

994


In multi-threading how can we ensure that a resource isn't used by multiple threads simultaneously?

1381


How many threads does a core java have?

1129


'A class is a template for an object' explain this statement.

1099


What is java basic concept?

1093


Can you call a method on a null object?

1060


Explain the private protected method modifier?

1029


What is an exception? difference between Checked and Unchecked exception in Java

1057


How is tree Mirroring implemented?

1124


How many types of memory areas are allocated by jvm?

1086


Lowest Common ancestor in a Binary Search Tree and Binary Tree.

981


Can size_t be negative?

1246


What is local variable and instance variable?

1102


Why we used vector class?

1115


What's the base class of all exception classes?

1116