+ 1

How to print this program

* * * * *

10th Nov 2016, 10:50 AM
Anand
Anand - avatar
3 Answers
+ 2
#include <iostream> using namespace std; int main() { for(int i=0;i<3;i++){ for(int j=2-i;j>0;j--) { cout<<" "; } cout<<"*"; for(int k=0;k<2*i-1;k++){ cout<<" "; } if(i!=0) cout<<"*"; cout<<endl; } return 0; }
10th Nov 2016, 11:26 AM
kamal joshi
kamal joshi - avatar
+ 2
#include <iostream> using namespace std; int main() { int i,j,n; for(i=0;i<3;i++) { for(n=4;n>i;n--) { cout << " "; } for(j=0;j<i+1;j++) { if(i==2&&j==1){ cout << " "; continue; } cout << "* "; } cout << "\n"; } return 0; }
10th Nov 2016, 12:01 PM
Aditya kumar pandey
Aditya kumar pandey - avatar
- 1
cout << " *"; cout << " * *"; cout << "* *";
10th Nov 2016, 10:55 AM
Maurizio Urso
Maurizio Urso - avatar