Number pattern program in C++

In this section you will learn how to print number in c++ in easy way. We will print the number with help of for loop condition and then we will show the output on screen. In this program we are taking the input from user.

How program will work?

Program of print number pattern in c++


	#include<iostream.h>
	#include<conio.h>

	//NUMBER PATTREN PROGRAM
	void main()
	{
		int value, i, k;
		clrscr();
	
		cout<<"ENTER NUMBER TO PRINT THE STAR:- ";
		cin>>value;

		for(i=1; i<=value; i++)
		{
			for(k=1; k<=i; k++)
			{
			 	cout<<i;
			}
			cout<<"\n";
		}
		
	getch();
	}

Output:

	
	ENTER NUMBER TO PRINT THE NUMBER:- 5
	
	1
	22
	333
	4444
	55555

Post Your Comment