I need gelp with writing a c++ code using visual studios to print out this pattern, please:
1******
12*****
123****
1234***
12345**
123456*
1234567
Program:
#include <iostream>
using namespace std;
int main()
{
// Declaring variables
int num = 7, num1 = 7;
// This nested for loop will display the pattern
for (int i = 1; i <= num1; i++)
{
for (int j = 1; j <= i; j++)
{
cout << j;
}
num = num - 1;
for (int k = 1; k <= num; k++)
{
cout << "*";
}
cout << endl;
}
return 0;
}
_______________
Output:
_______________
____________Thank YOu
Get Answers For Free
Most questions answered within 1 hours.