write a program for the series 1+x+x2+x3+……+xn using loop in c language.
#include<stdio.h>
#include<conio.h>
Void main( )
{
Float
series=1;
Int
i,n,x,p=1;
Printf(“enter
the value of n –“);
Scanf(“%d”,&n);
Printf(“\n\n
enter the value of x :”);
Scanf(“%d”,&x);
For(i=o;i<=n;i++)
{
For(j=o;j<=I;j++)
{
P=p*x;
}
Series=series+p;
}
Printf(“series=%f”,series);
}
No comments
Post a Comment