Minggu, 01 Juli 2012

Program Perulangan

Contoh 1 increment (FOR)

#include<iostream.h>
#include<conio.h>
main(){
for(int i=0;i<3;i++)
{cout<<i<<endl;}
getch();}



Contoh (While)


#include<iostream.h>
#include<conio.h>
main(){
int i=1;
while(i<10)
{cout<<i<<endl;
i+=2;}
getch();}



0 komentar:

Posting Komentar