0

please help me sort this in c++ program

the program is to print the following output using c++ this is a symbol of asterisk--- * * * * * *

20th Oct 2016, 10:06 AM
prasad dongre
prasad dongre - avatar
1 Réponse
+ 1
#include <iostream> using namespace std; int main() { for(int i=1;i<=3;i++) { for(int j=1;j<=3-i;j++) cout<<" "; for(int k=1;k<2*i;k++) { if(k%2==1) cout<<"*"; else cout<<" "; } cout<<endl; } return 0; }
6th Nov 2016, 1:49 PM
Megatron
Megatron - avatar