0

Write a program using nested loop to give output as a given below through C++. Course

A A A A A A A A A A A A A A A A

9th Sep 2017, 1:59 AM
Raj Kumar
Raj Kumar - avatar
1 Odpowiedź
+ 5
#include <iostream> using namespace std; void printSpaces(int i) { for(int j = 0; j < i; ++j) { cout << " "; } } void printA(int i) { for(int j = i; j < 7; ++j) { cout << "A"; printSpaces(1); } } int main() { for(int i = 0; i < 8; i+=2) { printSpaces(i); printA(i); cout << endl; } return 0; }
9th Sep 2017, 2:38 AM
ChaoticDawg
ChaoticDawg - avatar