#include
int a,b,n,Un,i;
void aritmetika(int Un);
main()
{
printf("Program Deret Aritmetika");
printf("\n------------------------\n");
printf("Bilangan pertama (a)= ");scanf("%i",&a);
printf("Beda (b)= ");scanf("%i",&b);
printf("Suku ke n = ");scanf("%i",&n);
printf("\nDeret Aritmetika bilangannya :\n");
aritmetika(Un);
}
void aritmetika(int Un)
{
Un= a + (n-1)*b;
i = a;
while (i <= Un)
{
printf("%d ", i);
i = i + b;
} }
0 comments:
Post a Comment