0
Good morning .how can do this figure in function
1 22 333 4444 55555
4 Antworten
+ 5
Here, like this ☺️😉
https://code.sololearn.com/cAsczbdtu0l8/?ref=app
+ 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;
}
    
+ 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.
+ 1
thank you 







