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

Where we use clrscr in c?

1094


What is the difference between far and near ?

1156


What is c standard library?

1151


Which are low level languages?

1047


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

1955


What do header files do?

1022


In a switch statement, explain what will happen if a break statement is omitted?

999


How are variables declared in c?

1032


What are the functions to open and close the file in c language?

989


i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical

2278


Explain what is the difference between the expression '++a' and 'a++'?

1155


What are multidimensional arrays?

1068


What is the difference between scanf and fscanf?

1202


Why cant I open a file by its explicit path?

991


Did c have any year 2000 problems?

1063