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
Where we use clrscr in c?
What is the difference between far and near ?
What is c standard library?
Which are low level languages?
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
What do header files do?
In a switch statement, explain what will happen if a break statement is omitted?
How are variables declared in c?
What are the functions to open and close the file in c language?
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
Explain what is the difference between the expression '++a' and 'a++'?
What are multidimensional arrays?
What is the difference between scanf and fscanf?
Why cant I open a file by its explicit path?
Did c have any year 2000 problems?