This application generates an AP series using a while loop by specifying the first term, common difference and the number of terms.
#include <stdio.h>
#include <conio.h>int main(void)
{
int repeat=1;while(repeat==1)
{int a, d, n;
printf(“Enter first term\n“);
scanf(“%d“, &a);
printf(“Enter the common difference\n“);
scanf(“%d“, &d);
printf(“Enter number of terms\n“);
scanf(“%d“, &n);while(n>0)
{
printf(“%dt“, a);
a=a+d;
n=n–1;
}printf(“\n\nRepeat[1]\nExit[0\]n“);
scanf(“%d“, &repeat);
}
getch();
}
Download the Application (.exe)
4 Comments
wow tz prob is great !
what you have given was simple and easy to understand .. :) thx
Thank you :)
Thinking like that shows an eerxpt at work