Programming: C++ C++ Question #4052 from kuldeep
Write a program to produce design usibg nested loop
& & & & & & &
& & & & &
& & &
&
Expert's answer
#include <iostream>
int main()
{
int i,j;
int n=7; // an ODD number of & in the first line
for(i=0; i<n/2+1; i++) {
for(j=0; j<i; j++) {
std::cout << " ";
};
for (j=i; j<n-i-1; j++) {
std::cout << "& ";
};
std::cout << "&" << std::endl;
};
};
Comments
Ask Your question
Related Questions
Link to us
Share with friends
Get homework help with AssignmentExpert:









No comments
Leave a comment