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 a 5 digit number and calculates 2
power that number and prints it.

Answer Posted / umesh

// This will yield the result if user enters only 5 digit
number.

//import headers

class power
{
public static void main(string args[])
{
system.out.println("Enter 5 digit number : ");
n = system.in.readline();
b =0;
len = n.length();

if(len == 5)
{
a=Integer.ParseInt(n)
for i=0;i<a;i++
{
b = 2*2;

}
system.out.println("2 power entered 5 digit number is :
"+b)
}
else
{
system.out.println("Entered number in more/less than
5 digits")
}

}

//Sorry, not much familiar about the syntax.. but here is
the logic..

Is This Answer Correct ?    3 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How did c++ start?

1050


When do we run a shell in the unix system? How will you tell which shell you are running?

924


Why do we use classes in c++?

1010


What are all predefined data types in c++?

1086


Is dev c++ a good compiler?

908


What is the difference between reference and pointer?

1106


What is an accessor in c++?

1038


I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?

2035


What is bubble sort c++?

963


Can you sort a set c++?

953


What is polymorphism & list its types in c++?

1022


What is c++ best used for?

1025


Explain what you mean by a pointer.

1067


Is c++ proprietary?

1019


Why ctype h is used in c++?

921