Tuesday, February 22, 2011

Nested loop in c programming




A loop inside another loop
is known as nested loop. We can write any loop inside any loop in c i.e. we can
write for loop inside the loop or while loop or do while loop etc. For example:



(a)

#include

int main(){

int i,j,k;

for(i=0;i<3;i++){

for(j=0;j<3;j++){


printf(" %d",i+j);


}

}

return 0;

}



(b)

#include

int

No comments:

Post a Comment