Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

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)

Answers were Sorted based on User's Feedback

Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should..

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

Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should..

int main(int argc, char *argv)
{
long two_power, five_digit_number;

if(scanf("%ld",&five_digit_number)){
two_power = five_digit_number*five_digit_number;}
printf("\n 2 power of that number is %ld",two_power);

return 0;
}

 Is This Answer Correct ? 13 Yes 29 No

More C Interview Questions

what is a stack

what is the difference between NULL & NUL keywords in C?

How can I access a memory located at certain address?

Write a C program to help a HiFi’s Restaurant automate its breakfast billing system. Your assignment should implement the following items: a. Show the customer the different breakfast items offered by the HiFi’s Restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill to the customer. d. Produce a report to present your complete program and show more sample output. Assume that the HiFi’s Restaurant offers the following breakfast menu: Plain Egg \$2.50 Bacon and Egg \$3.45 Muffin \$2.20 French Toast \$2.95 Fruit Basket \$3.45 Cereal \$0.70 Coffee \$1.50 Tea \$1.80

What are qualifiers and modifiers c?

write a programme to enter some number and find which number is maximum and which number is minimum from enterd numbers.

why array index always starts from zero??

Write a program that takes a 5 digit number and calculates 2 power that number and prints it

write a program to add two numbers of any size.....(remember any size)

LOGIC OF Bodmas?

What is fflush() function?

A program to allow an input operand and operator from the operator and read on the display and output operand.

Categories