CONTOH
FOR:
#include
#include
#include
void
main ()
{
int a;
for
(a=1;a<=10;++a)
getch();
}
Project
1:
#include
#include
#include
void
main ()
{
int a;
for(a=10;a>=1;--a)
cout<<"\n";
getch();
}
PROJECT
2:
#include
#include
#include
void
main ()
{
int a;
for(a=1;a<=10;a=a+2)
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