ਸੀਰੀਜ: x
2 + x
4 + x
6 +..........+ x
n
#include<stdio.h>
#include<conio.h>
void main()
{
int x, n, i;
long sum=0;
printf("Enter value of x:");
scanf("%d",&x);
printf("Enter value of n:");
scanf("%d",&n);
for(i=2;i<=n;i+=2)
{
sum+=pow(x,i);
}
printf("Answer is %ld",sum);
getch();
}
Output:
Comments
Post a Comment