menu search
brightness_auto
more_vert

In the below pattern each column contains N number of stars where N is the number of rows. The number of rows and columns are the same so we can assume it as a square matrix.

Enter the number of rows: 5
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *

thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike

1 Answer

more_vert
 
verified
Best answer

Code :

#include<stdio.h>
int main()
{
   int n,i,j;

   printf("Enter the number of rows: ");
   scanf("%d",&n);

   for(i=1; i<=n; i++)
   {
     for(j=1; j<=n; j++)
     {
       printf("* ");
     }
     printf("\n");
   }

   return 0;
}

 

thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike

Related questions

thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

648 users

...