-->

WEAP to display following star pattern

/*program to display following

* * * * *
* * * * *
* * * * *
* * * * *
* * * * *

*/
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,j;
for(i=1;i<=5;i++)      //for number of rows. there are five rows so loop moves fives times
  {
    for(j=1;j<=5;j++) //it displays star five times.It displays in columns
      {
printf("* ");
      }
    printf("\n");
}
getch();
}

------------------------------------
logic in mind:-
1)we have to display five rows and five columns.
2) we have used outer loop five times.
3)and inner loop five times.
-------------------------------
 program 's screenshot





output







No comments:

Post a Comment