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..

Answer / 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

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

Answer / nitin katakdound

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

Post New Answer

More C Interview Questions

what is a stack

3 Answers  


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

3 Answers  


How can I access a memory located at certain address?

2 Answers   CSC,


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

0 Answers  


What are qualifiers and modifiers c?

0 Answers  






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

3 Answers  


why array index always starts from zero??

4 Answers   TCS,


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

7 Answers  


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

1 Answers  


LOGIC OF Bodmas?

1 Answers  


What is fflush() function?

0 Answers  


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

0 Answers  






Categories