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

What should malloc() do?

1148


Write a program in c to replace any vowel in a string with z?

1098


Difference between linking and loading?

1089


why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above

1109


Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent

2111


Explain threaded binary trees?

1142


Differentiate between functions getch() and getche().

1027


What are control structures? What are the different types?

1075


How can I get back to the interactive keyboard if stdin is redirected?

1169


What is scope and lifetime of a variable in c?

1034


What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

1410


What is an array in c?

1036


What is the collection of communication lines and routers called?

1105


Why we use void main in c?

1146


Explain what is the use of a semicolon (;) at the end of every program statement?

1214