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 |
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
How will you allocate memory to double a pointer?
One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.
write a program to print data of 5 five students with structures?
sir i got 146 correct question & i have also the advantage of height so will they consider my marks as 146+3=149.can any body tell me how they consider my height marks.
What is the purpose of Scanf Print, getchar, putchar, function?
main() { char p[] = "hello world!"; p = "vector"; printf("%s",p); }
2 Answers Vector, Vector India,
#include<stdio.h> #include<conio.h> # define swap(a,b) temp=a; a=b; b=temp; void main( ) { int i, j, temp; i=5; j=10; temp=0; if( i > j) swap( i, j ); printf( "%d %d %d", i, j, temp); }
2.Given the short c program that follows a. make a list of the memory variables in this program b.which lines of code contain operations that change the contents of memory? what are those operations? Void main( void) { Double base; Double height; Double area; Printf(“enter base and height of triangle :”); Scanf(“%lg”, &base); Scanf(“%lg”, &height); Area=base*height/2.0; Printf(“the area of the triangle is %g \n”,area); }
why TCS selected more student in the software field from all institution.
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
what is data structure