+ 1

I need 1 22 333 4444 55555 answer

how please help me

20th Dec 2017, 7:05 PM
Praveen Kumar
Praveen Kumar - avatar
4 odpowiedzi
+ 7
For that a nested loop will do the trick. The inner loop (b) outputs the number whilst the outer loop (a) controls what number will be output #include <iostream> using namespace std; int main() { for (int a = 1; a <=5; a++) { for(int b =1;b<=a;b++){ cout << a; } cout << " "; } return 0; }
20th Dec 2017, 7:16 PM
Duncan
Duncan - avatar
+ 7
#include<iostream> using namespace std; int main()  {      int num, c, k;      cout<<"Enter number of rows : ";    cin>>num;  cout<<"\n"; for ( c = 1 ; c <= num ; c++ )  { for( k = 1 ; k <= c ; k++ )          {  cout<<c; }      cout<<"\n";    } }
20th Dec 2017, 7:17 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 7
Synchronized answers by 3 SoloLearners - now that's service 😎😎😎
20th Dec 2017, 7:37 PM
Duncan
Duncan - avatar
+ 3
#include<iostream> int main() { int a; std::cin>>a; for(int i=1;i<=a;i++) { for(int j=0;j<i;j++) std::cout<<i; std::cout<<" "; } }
20th Dec 2017, 7:16 PM
💻Amey💻
💻Amey💻 - avatar