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

How can I find the modification date of a file?

0 Answers   Celstream,


what is the difference b/w compiler and debugger?

2 Answers   Assurgent,


Is c easier than java?

0 Answers  


What are 3 types of structures?

0 Answers  


how to write a c program to print list of fruits in alpabetical order?

0 Answers  


Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.

0 Answers  


what is the use of fflush() function?

2 Answers  


write a program in c to print **** * * * * ****

1 Answers   TCS,


What is the sizeof () operator?

0 Answers  


What are structures and unions? State differencves between them.

0 Answers   iNautix,


#include<stdio.h> #include<conio.h> void main() { clrscr(); int a=0,b=0,c=0; printf("enter value of a,b"); scanf(" %d %d",a,b); c=a+b; printf("sum is %d",c); getch(); }

2 Answers  


Explain how can I prevent another program from modifying part of a file that I am modifying?

0 Answers  


Categories