#include <iostream>
#include <cmath>
using namespace std;
// inverted star pattern problem in C++
int main() {
int n = 4;
//outer loop
for(int i=1; i <= n; i++){
// inner loop
for(int j = 1; j <= n-i+1; j++){
// work
cout << "* ";
}
cout << endl;
}
return 0;
}
OUTPUT-
* * * *
* * *
* *
*
No comments:
Post a Comment