Sunday, 7 August 2016

NESTING OF FOR LOOP

#include<stdio.h>
void main()
{
 int i,j;
 for (i=1;i<=5;i++)  //excuting 1st loop
 {
  for(j=1;j<=i;j++) //excuting 2nd loop
  {   printf("#");    } //printing the # at 'i' times
        printf("\n");   //after 2nd loop printing next line
 }
}

output :
#
##
###
####
#####

No comments:

Post a Comment

smhjifrivly@gmail.com