Simple Pattern program in C
Simple Pattern Program in C:
I just want to start one new series of pattern programs. So as a first program in this series, let’s start with the basic or simple pattern program. It is a Rectangular Start pattern Program.
It is a straightforward program with two for loops and The outer for loop is responsible for rows logic and The inner for loop is responsible for columns logic.
So if user provides the input as 5. The outer for loop will start from 1 and goes upto the number 5. Similarly the Inner for loop starts with 1 and goes till the number 5. At each Outer loop iteration, The inner for loop will iterate given number times ( i.e 5).
Q: Write a C Program to print below simple star pattern.
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
Simple Pattern Program [ Rectangular Star Pattern] :
-
#include<stdio.h>
-
int main()
-
{
-
int i,j,k;
-
printf(“Enter how many rows you want: “);
-
scanf(“%d”,&n);
-
// for loop with control variable i is to control the Rows.
-
// for loop with control variable j is to control the Columns.
-
for(i=1;i<=n;i++)
-
{
-
for(j=1;j<=n;j++)
-
printf(” *”);
-
-
printf(“n“);
-
}
-
return 0;
-
}
Output :
Also See:
- Program to calculate Maximum of three numbers.
- What are Prime Number and C program to Check given number is Prime or Not
- Check given Number is Prime or not Using Square Root(sqrt) Function.(Efficient way)
- C Program to generate prime numbers between two numbers
- C Program to generate first N prime numbers.
- C program to Calculate percentage of student.
- C Program to check given year is the leap or not.
- C Program to convert Temperature.
- C program to understand type conversation.
- Finding Largest of two numbers using the conditional operator in C.
- C program to calculate the simple Interest,
- C program to understand Size of Operator.
- 200+ C Programs.
Nice blog, keep sharing all type of program…