SELAMAT DATANG KE BLOG SAYA
MOGA BERMANFAAT UNTUK ANDA

Rabu, 13 April 2011

NESTED FOR




#include<iostream.h>

main()

{

int a,b;

clrscr();

cout<<" program nested for \n ";

for(a=1; a<=5; a+=5)

{

printf("\n");

for(b=a; b<=1; b+=1)

cout<<a<<" ";

}



for(a=1; a<=4; a+=4)

{

printf("\n");

for(b=a; b<=2; b+=1)

cout<<a<<" ";

}

for(a=1; a<=3; a+=3)

{

printf("\n");

for(b=a; b<=3; b+=1)

cout<<a<<" ";

}

for(a=1; a<=4; a+=4)

{

printf("\n");

for(b=a; b<=4; b+=1)

cout<<a<<" ";

}

for(a=1; a<=5; a+=5)

{

printf("\n");

for(b=a; b<=5; b+=1)

cout<<a<<" ";

}

getch();

}

Tidak ada komentar:

Posting Komentar