Dasar Pemrograman (Tutorial C++ ke-4 Pengulangan while, do-while, dan for)

1. Sourcecode for

#include
#include
main(){
short bil;
for(bil=1; bil<=10; bil++){
    if(bil%2==0)
        cout<
      else
      cout<
}
getch();
}

2. Sourcecode while

#include
#include
main(){
int i=1;
while(i<10 div="">
if(i%2==0){
    cout<
    }
    else{
    cout<
    }
   i++;
}
getch();
}

3. Sourcecode do-while (menghitung nilai rata-rata - download disini)



Previous
Next Post »