Athematic Program in C Programming Language
#include <stdio.h>
int main() {
printf( "Arithmetic Progression : \n" );
printf( "\n" );
float firstTerm = 24;
float commonDifference = 7.5;
int numberOfTerms = 15;
float ithTerm;
int i;
printf( "first term : %f \n" , firstTerm);
printf( "common difference : %f \n" , commonDifference);
printf( "number of terms : %d \n" , numberOfTerms);
printf( "\n" );
//Arithmetic Progression
printf( "Arithmetic Progression : \n" );
for (i = 0; i < numberOfTerms; i++)
{
ithTerm = firstTerm + i * commonDifference;
printf( "%f \n" , ithTerm);
}
printf( "\n" );
return 0;
}
Post a Comment