C Program to draw Number pattern VIII

Description

Input:
5
output:
1
22
333
4444
55555
4444
333
22
1

Solution

#include<stdio.h>
#include<math.h> 
int main()
{
	int i,j,k,n,step=1;
	printf("enter row size:");
	scanf("%d",&n);
	for(i=1;i<=2*n-1;i++)
	{
		for(j=1;j<=step;j++)
		{
			printf("%d",step);
		}
		
		if(i<n)
		{
			step+=1;			
		}
		else
		{	
			step-=1;			
		}
		printf("\n");
	}
	return 0;
}

Explanation

Refer Video tutorial



Interesting Pattern Programs: for more Patterns

Input:
5
Output:
*
**
***
****
*****
****
***
**
*Solution
Input:
5
Output:
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *Solution
Input:
5
Output:
*        *
**      **
***    ***
****  ****
**********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********
**** ****
***   ***
**     **
*       *Solution
Input:
5
Output:
*********
 *******
  *****
   ***
    *
   ***
  *****
 *******
*********Solution