Program to find the value of e raised to power x using while
loop

Answers were Sorted based on User's Feedback



Program to find the value of e raised to power x using while loop..

Answer / pragathi

#include<stdio.h>
void main()
{
int i=1,e,x,s,p=1;
printf("Enter e and x :");
scanf("%d%d",&e,&x);
while(i<=x)
{
p=p*e;
i++;
}

printf("power is %d ",p);
}

here pow(e,x) is calculated using this program.

Is This Answer Correct ?    46 Yes 40 No

Program to find the value of e raised to power x using while loop..

Answer / s.d.bahinipati

#include<stdio.h>
#include<math.h>
main()
{
int i,j,n,x,fact=1;
float c,t,sum=1;
printf("enter the value of x and n);
scanf("%d%d",&x,&n);
while(i<n-1)
{
c=pow(x,i);
for(j=1;j<i;j++)
fact=fact*j;
t=c/fact;
sum=sum+t;
}i=i+1;
printf("the sum of series is %f",sum);
getch();
}

Is This Answer Correct ?    34 Yes 28 No

Program to find the value of e raised to power x using while loop..

Answer / tirtharaj dash

#include<stdio.h>
#include<conio.h>
#define e 2.718281828

int main()
{
double ex=e;
int x,i=0;
printf("\nenter the power : ");
scanf("%d",&x);
while(i++!=x-1)
{
ex*=e;
}
printf("\nthe result is : %f",ex);
getch();
return 0;
}

/*i hope u get the logic.....TR dash*/
note:--->run in dev C++ / TC

Is This Answer Correct ?    9 Yes 17 No

Program to find the value of e raised to power x using while loop..

Answer / ayyanar.m

include<stdio.h>
#include<math.h>
main()
{
int i=1,e,x,c;
printf("enter the value of x and e);
scanf("%d%d",&x,&e);
while(i<=e)
{
c=pow(x,e);
i=i+1;
}
printf("the sum of series is %f",c);
getch();
}

Is This Answer Correct ?    8 Yes 21 No

Program to find the value of e raised to power x using while loop..

Answer / amit

#include<stdio.h>

void main()
{
int sum,n;
fact x,y;

printf("Enter the exponential(E) value");
scanf("%f ",y);

printf("Enter the value for x");
scanf("%f",x);

printf("No. of times x is to be multiplied");
scanf("%d",n);

while(e=n)
{
sum=x^n;
printf("The result of expression is =%d",sum);
printf("Check this out%d");
}
}

Is This Answer Correct ?    34 Yes 71 No

Post New Answer

More C Interview Questions

#include<stdio.h> #include<conio.h> void main() {clrscr(); char another='y'; int num; for(;another=='y';) { printf("Enter a number"); scanf("%d",&num); printf("squre of %d is %d",num,num*num); printf("\nwant to enter another number y/n"); scanf("%c",&another); } getch(); } the above code runs only one time.on entering 'y' the screen disappeares.what can i do?

3 Answers  


Why do u use # before include in a C Progam?

9 Answers   IBM,


consider the following program sigment int n,sum=1; switch(n) { case 2:sum=sum+2; case 3:sum*=2; break; default:sum=0;} if n=2, what is the value of sum a.0 b.6 c.3 d.none

7 Answers   TCS,


how to find out the biggest element (or any other operation) in an array which is dynamic. User need not to mention the array size while executing.

3 Answers  


Write a C program that defines a 2-dimentional integer array called A [50][50]. Then the elements of this array should randomly be initialized either to 1 or 0. The program should then print out all the elements in the diagonal (i.e. a[0][0], a[1][1],a[2][2], a[3][3], ……..a[49][49]). Finally, print out how many zeros and ones in the diagonal.

3 Answers   Infosys,






What is void main ()?

0 Answers  


Is reference used in C?

1 Answers  


how to capitalise first letter of each word in a given string?

0 Answers  


what is use#in c

3 Answers  


a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above

0 Answers  


Explain what is the stack?

0 Answers  


What is the difference between typedef struct and struct?

0 Answers  


Categories