Computer Science, asked by kumaranand0950, 7 months ago

Write programs to print the following outputs using for loops.
(b)
(a) 1
2 2
3 3 3
4 4 4 4
5 5 5 5 5​

Answers

Answered by srajfaroquee
1

Note: I am using C++ language.

#include<iostream>

using namespace std;

int main () {

for(int i =1 ; i <=5 ; i++ ) {

int k = i ;

while ( k >0) {

      cout<<i <<" " ;

     k--;

}

cout<<endl;

}

return 0;

}

**Please mark this answer as Brainliest answer!

Similar questions