C program for Arithmetic Progression calculation
***************************************Program***********************************
#include<stdio.h> #include<conio.h> main() { int a,n,d,t; printf("Enter the first term of your AP : "); scanf("%d",&a); printf("Enter the difference b/w terms : "); scanf("%d",&d); printf("Enter the number of terms you want to get in your AP : "); scanf("%d",&n); printf("AP of your given data is :\n%d ",a); while(n>=0) { t=a+d; printf("%d ",t); a=t; n--; } getch(); }
***************************************Output************************************
Output of AP program in C |
No comments