#include<iostream.h>
#include<conio.h>
void main()
{
int a;
cout<<"===============================================";
cout<<endl;
cout<<"PERRULANGAN BILANGAN DARI ANGKA DARI 1 SAMPAI 10";
cout<<endl;
cout<<"===============================================";
cout<<endl;
cout<<endl;
cout<<"do_while_perulangan 1-10";
cout<<endl;
a=0;
do
{
a++;
cout<<","<<a;
}
while (a<10);
cout<<endl;
cout<<endl;
cout<<"do_while_perulangan bilangan genap";
cout<<endl;
a=0;
do
{
a+=2;
cout<<","<<a;
}
while (a<10);
cout<<endl;
cout<<endl;
cout<<"do_while_perulangan bilangan ganjil";
cout<<endl;
a=-1;
do
{
a+=2;
cout<<","<<a;
}
while (a<9);
cout<<endl;
cout<<endl;
cout<<"===============================================";
cout<<endl;
cout<<"===============================================";
cout<<endl;
cout<<endl;
cout<<"for_perulangan bilangan 1-10";
cout<<endl;
cout<<endl;
for (a=1;a<=10;a++)
{
cout<<","<<a;
}
cout<<endl;
cout<<endl;
cout<<"for_perulangan bilangan genap";
cout<<endl;
for (a=1;a<10;a++)
{
a+=1;
cout<<","<<a;
}
cout<<endl;
cout<<endl;
cout<<"for_perulangan bilangan ganjil";
cout<<endl;
for (a=-1;a<9;)
{
a+=2;
cout<<","<<a;
}
cout<<endl;
cout<<endl;
cout<<"===============================================";
cout<<endl;
cout<<"===============================================";
cout<<endl;
cout<<endl;
cout<<"while_perulangan bilangan 1-10";
cout<<endl;
cout<<endl;
a=1;
while(a<=10)
{
cout<<","<<a;
a++;
}
cout<<endl;
cout<<endl;
cout<<"while_perulangan bilangan genap";
cout<<endl;
a=2;
while(a<=10)
{
cout<<","<<a;
a+=2;
}
cout<<endl;
cout<<endl;
cout<<"while_perulangan bilangan ganjil";
cout<<endl;
a=1;
while(a<10)
{
cout<<","<<a;
a+=2;
}
getch();
}
Tidak ada komentar:
Posting Komentar