Pattern 34: Number pattern program in C Language

 

Number Pattern Program in C:

Print below number pattern program in C programming language. 

The program should take number of rows as the input and display the pattern based on the user input. 

Here are couple of examples with Input and output.

Example 1:

Enter how many rows you want : 5
 1
 2 2
 3 3 3
 4 4 4 4
 5 5 5 5 5

Example 2:

Enter how many rows you want : 9
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
6 6 6 6 6 6
7 7 7 7 7 7 7
8 8 8 8 8 8 8 8
9 9 9 9 9 9 9 9 9

 

Program Logic:

From above examples, We can see the pattern is printing 1 in the first row and 2 in the second row, and 3 in the third row and so on. 

Which means we just need to print the rows number at each level.

But how many times we need to print for each row? We are trying to print the pattern in the triangle shape. So we can get the triangle shape by incrementing the number of values to print by 1 for each row. 

So at first row, We will print 1 value, And second row we will print two times, and so on at 9th row we will print 9 times. 

Let’s convert this into the c program.

 

Also Check:

 

Number Pattern Program in C:

Program Output:

 
 
 

Similar Number Patterns:

Similar Star pattern programs :

 

Venkatesh

Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

Leave a Reply