For, While , & Do...While

Posted by ♪~GazE-KizukI~♪.exe On Sabtu, 27 Maret 2010 0 komentar



CONTOH FOR:

#include
#include
#include
void main ()
{
int a;
for (a=1;a<=10;++a)
cout <
getch();
}





Project 1:

#include
#include
#include
void main ()
{
int a;
for(a=10;a>=1;--a)
cout <
cout<<"\n";
getch();
}





PROJECT 2:

#include
#include
#include
void main ()
{
int a;
for(a=1;a<=10;a=a+2)
cout <
cout<<"\n";
getch();
}





While:

#include
#include
#include
void main()
{
int bil =1;
while (bil <=10)
{
cout<<<"";
++bil;
}
cout<<"\n";
getch();
}




While genap:

#include
#include
#include
void main()
{
int bil =2;
while (bil <=10)
{
cout<<<"";
bil=bil+2;
}
cout<<"\n";
getch();
}




DO WHILE:

#include
#include
#include
void main()
{
int bil =2;
do
{
cout << bil<<"";
bil+2;
}
while(bil<=0);
getch();
}

0 komentar:

Posting Komentar