0
to print the output: N NA NAM NAME
2 Answers
+ 1
#include <iostream>
using namespace std;
int main() {
int i, j;
string s = "NAME";
for (i = 0; i < 4; i++) {
for (j = 0; j <= i; j++) {
cout << s[j];
}
cout << endl;
}
return 0;
}
0
declare a char array, print characters in loop.