# Answer to Question #70468 in C++ for SELBY MANYATSI

Question #70468

write program in c++ using for loops statements to print a circle of stars and diamond of stars

New

New

Expert's answer

#include <iostream>

using namespace std;

const int N = 12;

int main()

{

int c, k, s = 1;

s = N - 1;

for (k = 1; k<=N; k++)

{

for (c = 1; c<=s; c++)

cout<<" ";

s--;

for (c = 1; c<= 2*k-1; c++)

cout<<"*";

cout<<"\n";

}

s = 1;

for (k = 1; k<= N - 1; k++)

{

for (c = 1; c<= s; c++)

cout<<" ";

s++;

for (c = 1 ; c<= 2*(N-k)-1; c++)

cout<<"*";

cout<<"\n";

}

return 0;

}

using namespace std;

const int N = 12;

int main()

{

int c, k, s = 1;

s = N - 1;

for (k = 1; k<=N; k++)

{

for (c = 1; c<=s; c++)

cout<<" ";

s--;

for (c = 1; c<= 2*k-1; c++)

cout<<"*";

cout<<"\n";

}

s = 1;

for (k = 1; k<= N - 1; k++)

{

for (c = 1; c<= s; c++)

cout<<" ";

s++;

for (c = 1 ; c<= 2*(N-k)-1; c++)

cout<<"*";

cout<<"\n";

}

return 0;

}

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment