Learn about Square with stars Pattern Program in C in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
Contents
Square with stars Pattern Program in C
Pattern:
* * * * * * * * * * * * * * * * * * * * * * * * *
Program:
#include<stdio.h>
int main()
{
int n;
printf("Enter the number of rows: ");
scanf("%d",&n);
for(int r=1; r<=n; r++)
{
for(int c=1; c<=n; c++)
{
printf("* ");
}
printf("\n");
}
return 0;
}
Output:
Enter the number of rows: 5 * * * * * * * * * * * * * * * * * * * * * * * * *
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Codes :
Check Armstrong number of order N in a given range
C program to Check Armstrong Number of order N