Friday, 21 March 2014

C Program for Demonstration of nested loops


/* Demonstration of nested loops */
main( )
{
int   r, c, sum ;
for ( r = 1 ; r <= 3 ; r++ )  /* outer loop */
{
for ( c = 1 ; c <= 2 ; c++ )  /* inner loop */
{
sum = r + c ;
printf ( "r = %d c = %d sum = %d\n", r, c, sum ) ;
}
}
}

No comments:

Post a Comment