Jumat, 02 Desember 2016
Program looping ganjil BSI
#include <stdio.h>
#include <conio.h>
main()
{
int a,b;
b=0;
for(a=1;a<=9;a+=2)
{
printf("%i ",a);
b=a+b;
}
printf("= %i ",b);
printf("\n");
b=0;
for(a=1;a<=7;a+=2)
{
printf("%i ",a);
b=a+b;
}
printf("= %i ",b);
printf("\n");
b=0;
for(a=1;a<=5;a+=2)
{
printf("%i ",a);
b=a+b;
}
printf("= %i ",b);
printf("\n");
b=0;
for(a=1;a<=3;a+=2)
{
printf("%i ",a);
b=a+b;
}
printf("= %i ",b);
printf("\n");
b=0;
for(a=1;a<=1;a+=2)
{
printf("%i ",a);
b=a+b;
}
printf("= %i ",b);
printf("\n");
getch();
}
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar