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
What is the best organizational structure?
What is output redirection?
Write a program to check palindrome number in c programming?
What is the difference between functions getch() and getche()?
Can variables be declared anywhere in c?
What is selection sort in c?
Are the variables argc and argv are local to main?
What is the basic structure of c?
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
Write a code to determine the total number of stops an elevator would take to serve N number of people.
Write a code to remove duplicates in a string.
What are the back slash character constants or escape sequence charactersavailable in c?
Are enumerations really portable?
Is main an identifier in c?
How do I send escape sequences to control a terminal or other device?