Saturday, 15 October 2016

Program Deret Aritmatika

#include
#include
int a,r,x,n,Un,i;
void geometri(int Un);
main()
{
printf("Program Deret Aritmetika");
printf("\n------------------------\n");
printf("Bilangan pertama (a)= ");scanf("%i",&a);
printf("Rasio            (r)= ");scanf("%i",&r);
printf("Suku ke           n = ");scanf("%i",&n);
printf("\nDeret Aritmetika bilangannya :\n");
geometri(Un);

}



void geometri(int Un)
{
n=n-1;
x=pow(r,n);
Un= a*x;
i = a;

while (i <= Un)
{
printf("%d ", i);
i = i * r;
}
printf("\n\nsuku ke %i= %i\n",n+1,Un);
}

0 comments:

Post a Comment