Disini banyak lumayan banyak contoh program perulangan menggunakan while di bahasa c, disini juga sekaligus menggunakan prosedure
ini source code nya
/* AUTHOR : mahendra s praja (A11.2011.06050) BLOG : mahendra30.blogspot.com */ #include "stdio.h"; void no1(); void no2(); void no3(); void no4(); void no5(); void no6(); void no7(); void no8(); void no9(); int main(){ clrscr(); no1(); no2(); no3(); no4(); no5(); no6(); no7(); no8(); no9(); getche(); } void no1(){ int i= 1 ; while(i<=6){ printf("%d ",i); i++; } printf("\n\n"); } void no2(){ int i=1; while(i<=6){ printf("3 "); i++; } printf("\n\n"); } void no3(){ int i=1,j=3; while(i<=6){ printf("%d ",j); i++; j=j+2; } printf("\n\n"); } void no4(){ int i=1,j=90; while(i<=6){ printf("%d ",j); i++; j=j-2; } printf("\n\n"); } void no5(){ int i=1,jml=0; while(i<=6){ printf("%d",i); if(i<6){ printf(" + "); jml=jml+i; } i++; } printf(" = %d\n\n",jml); } void no6(){ int i=3,jml=0; while(i<=13){ printf("%d",i); if(i<13){ printf(" + "); jml=jml+i; } i=i+2; } printf(" = %d\n\n",jml); } void no7(){ int i=1,j=1; while(i<=6){ while(j<=6){ printf("%d ",j); j++; } j=1; i++; printf("\n"); } printf("\n"); } void no8(){ int i=6,j=1; while(i>=1){ while(j<=i){ printf("%d ",j); j++; } printf("\n"); j=1; i--; } printf("\n"); } void no9(){ int i=1,j=90,batas=82; while(i<=6){ while(j>=batas){ printf("%d ",j); j=j-2; } printf("\n"); j=90; batas=batas+2; i++; } printf("\n"); }
wah, copas punyaku ki http://arfianhidayat.com/
sumber disertakan donk
author juga jangan diganti