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

convert 12345 to 54321 withoutusing strig

5 Answers  


Explain what header files do I need in order to define the standard library functions I use?

0 Answers  


Snake Game: This is normal snake game which you can find in most of the mobiles. You can develop it in Java, C/C++, C# or what ever language you know.

7 Answers   Accenture, Gridco, IBM, Kevin IT, TCS, Vimukti Technologies,


print the pattern 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25 if n=5

3 Answers   Winit,


what is the difference between static variable and register variable?

3 Answers  






what is the meaning of java that is (J A V A) full form of JAVA

71 Answers   AKS University, Bhel, BNL, BPO, HCL, Peacecon,


what is array?

63 Answers   Amdocs, HCL,


What is difference between arrays and pointers?

0 Answers  


What are the usage of pointer in c?

0 Answers  


difference between loading and linking

1 Answers  


where do we use structure pointer?

1 Answers  


program for comparing 2 strings without strcmp()

4 Answers  


Categories