Blogger templates

Pages

Sunday 29 April 2012

C Program: Design the Program for the given Structure

design

NESTED FOR STATEMENT:
If one for statement is completely placed with in the other.

POINTS TO REMEMBER:
  • One loop must completely be placed inside the other loop means no overlapping of loops.
  • Each loop must have different variables.

#include<stdio.h>
void main()
{
int a,b;
char ch='*' ;

for(a=0 ;a<5 ;a++)
{
for(b=0 ;b<=a ;b++)
{
printf("%c" , ch);
}
printf("\n");
}                                                   // End of a loop
}                                                   // End of main()

0 comments:

Post a Comment