Write a program to print the sequence | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Write a program to print the sequence

1**** *2*** **3** ***4* ****5

17th Oct 2017, 6:22 PM
Victoria Kim
Victoria  Kim - avatar
2 Answers
+ 3
#include <iostream> using namespace std; int main() { for(int i = 1; i < 6; i++){ for(int j = 1; j < 6; j++){ if(i==j) cout<<i; else cout<<"*"; } cout<<"\n"; } return 0; }
17th Oct 2017, 6:29 PM
Kartikey Sahu
Kartikey Sahu - avatar
17th Oct 2017, 6:37 PM
Oma Falk
Oma Falk - avatar