#include<iostream>
using namespace std;
int main()
{
int batas;
cout<<"Masukkan Batas:";
cin>>batas;
cout<<"Menggunakan FOR"<<endl;
for(int i=0; i<=batas; i++){
cout<<" "<<i;
}
cout<<endl<<endl<<endl;
cout<<"Menggunakan WHILE"<<endl;
int i=0;
while (i<=batas){
cout<<" "<<i;
i++;
}
cout<<endl<<endl<<endl;
i=0;
cout<<"Menggunakan DO WHILE"<<endl;
do{
cout<<" "<<i;
i++;
}
while(i<=batas);
cout<<endl<<endl<<endl;
system("PAUSE");
return 0;
}
Selasa, 20 Desember 2011
Fungsi Perulangan
Langganan:
Posting Komentar (RSS)
Komentar :
Posting Komentar