Write a program to accept the number of rows and print a square.

/* Write a program to accept the number of rows and print the following output

* * * *

* * * *

* * * *

* * * *

using independent nested loop.*/

#include <stdio.h>

void main()

{

    int rows, i,j;

    printf("Enter the number of rows : ");

    scanf("%d",&rows);

    for(i=1;i<=rows;i++)

    {

        for(j=1;j<=rows;j++)

        {

            printf("* ");

        }

        printf("\n");

    }

    getch();

}

Comments

Popular posts from this blog

Write a program to accept numerator and denominator and find the remainder without using modulus (%) operator using do..while loop.