0

to print the output: N NA NAM NAME

15th Sep 2016, 7:26 AM
VINITA AGARWAL
VINITA AGARWAL - avatar
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; }
15th Sep 2016, 8:28 AM
Zen
Zen - avatar
0
declare a char array, print characters in loop.
15th Sep 2016, 8:15 AM
Nagendra Prajwal
Nagendra Prajwal - avatar