Wednesday, 23 September 2015

C PROGRAMMING -- GEOMETRIC SERIES

#include<conio.h>
#include<stdio.h>
#include<math.h>
void main()
{       clrscr();
int a,r,i,n,an;
printf("enter the common ratio= \tenter first term=\tenter no of terms required=\n");
scanf("%d%d%d",&r,&a,&n);

for(i=1;i<=n;i++)
{ an=a*pow(r,i-1);
printf("\t%d\t",an);
}
getch();
}

No comments:

Post a Comment