Monday, November 18, 2013

Perulangan (for) untuk variabel "123 berurutan ke bawah" dengan for double

Contoh Kode Perulangan sederhana:
#include <iostream>
using namespace std;

int d; // variabel global
int main(){
int a,b;
d=0; // variabel lokal
for (a=0; a<=3; a++)
{
for(b=0; b<=4; b++)
{
d++;
cout<<d<<" ";
}


cout<<"\n";
}
return 0;
}

Hasil nya :
Selamat Mencoba :)

No comments:

Post a Comment