Print the given pattern in C++
cout - Question 5
In this question, we will see how we can print the given pattern in C++ programming using the cout statement. To know more about cout statement click on the cout statement lesson.
Q5) Write a program in C++ to print the given pattern using cout statement on the screen.
5
45
345
2345
12345
Program
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
cout<<"5\n";
cout<<"45\n";
cout<<"345\n";
cout<<"2345\n";
cout<<"12345";
return 0;
}
Output
5 45 345 2345 12345