0

Good morning .how can do this figure in function

1 22 333 4444 55555

15th Apr 2017, 4:34 AM
Bts...
Bts... - avatar
4 Answers
+ 5
Here, like this â˜șïžđŸ˜‰ https://code.sololearn.com/cAsczbdtu0l8/?ref=app
15th Apr 2017, 4:48 AM
Shraddha
Shraddha - avatar
+ 5
i propose this solution : for(int i =1; i<6 ; i++){ string p1(i , (char)(i+48)); string p2( (6-i)/2 ,' '); cout<<p2+p1+p2<<endl; }
15th Apr 2017, 6:59 AM
Nizar GANNOUNI
Nizar GANNOUNI - avatar
+ 1
#include<iostream.h> #include<conio.h> void main() { int num; //required number cout<<"enter the final number="; cin>>num; for(int i=0;i<num;i++) { for(int j=num-i;j>0;j--) { cout<<" "; } for(int k=0;k<=i;k++) { cout<<i+1<<" "; }cout<<endl; } getch(); } Here you go.
15th Apr 2017, 6:11 AM
DEVIL kingg
DEVIL kingg - avatar
+ 1
thank you
15th Apr 2017, 6:53 AM
Bts...
Bts... - avatar