Write a program that takes a 5 digit number and calculates 2
power that number and prints it
Answers were Sorted based on User's Feedback
Answer / muz
@ ^^^
long int is not sufficient to hold the result of 2^(5 digit
number).
Even if u take long long <variable>, the result will be
displayed as infinity.
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / pradeep
Thank you for giving reply.
But the above program was not correct as Muz said Long int
is not sufficcient to hold result..........
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / cheela deepak
integer range is -32 768 to +32 767 so it doesn't display
value of 2^n(5 digit number)
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / manish soni bca 3rd year jaipu
#include<stdio.h>
#include<conio.h>
void main()
{
int n,p;
long int ans;
printf("Enter the number ans power");
scanf("%d %d",&n,&p);
ans=1;
while(p>0)
{
ans*=n;
p--;
}
printf("%ld",ans);
getch();
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / cheela deepak
integer range is not sufficient for given program so result
will not hold
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / manish soni bca 3rd year jaipu
o/p is ;
enter the number 11111
2
123454321
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / subhashini
void main()
{
long int n,x;
clrscr();
printf(" Enter 5 digit number:");
scanf("%d",&n);
x=2^n;
printf("result: %d",x);
getch();
}
Is This Answer Correct ? | 1 Yes | 9 No |
Find duplicates in a file containing 6 digit number (like uid) in O (n) time.
What is the output of below code? main() { static int a=5; printf("%3d",a--); if(a) main(); }
What is the difference between Printf(..) and sprint(...) ?
wht is the difference between KPO and BPO ?
2 Answers Accenture, BPO, HCK, HCL, Infosys,
Write code for initializing one dimentional and two dimentional array in a C Program?
5 Answers Deshaw, Edutech, GMD,
character array A[12] can hold
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
Why is event driven programming or procedural programming, better within specific scenario?
To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9
What does %f mean c?
what is c
What is the most efficient way to count the number of bits which are set in a value?