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(should not use big
integers and exponential functions)

Answer Posted / venu

sol 1:
int fun(int i5DigitNum)
{
return 2<< i5DigitNum; // will overflow if the number is > 32
}

sol 2:
//assumption 32 bit machine
temp = i5DigitNum/32 + i5DigitNum%32 == 0 ? 0 :1 ;
char * temp2 = malloc(temp*4)
temp2[0] = 1 << i5DigitNum%32;

// now print this array as number!! :(

Is This Answer Correct ?    4 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

1399


What is register variable in c language?

1036


What is a static function in c?

1180


Is that possible to store 32768 in an int data type variable?

1093


Differentiate between #include<...> and #include '...'

1068


What is the general form of function in c?

1023


Do variables need to be initialized?

1064


What is the process of writing the null pointer?

1031


What are the Advantages of using macro

1177


How many parameters should a function have?

1200


How do I use void main?

1096


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

1256


What does the function toupper() do?

1141


Explain union. What are its advantages?

1082


What is c language and why we use it?

1079