Write a Program X1 + X2 +X3 +X4+X5+X6……xn=?
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int
i,n,x,ans;
clrscr();
printf("\n
enter last number");
scanf("%d",&n);
printf("\n
enter value of x");
scanf("%d",&x);
for(i=1;i<=n;i++)
{
ans=pow(x,i);
printf("\n%d",ans);
}
getch();
}
|
OutPut :-
No comments:
Post a Comment