C++ Nested For Loops! Write a program that prints an oval using the character ’*
ID: 3669097 • Letter: C
Question
C++ Nested For Loops!
Write a program that prints an oval using the character ’*’. The user will enter the number of ’*’s on the middle row and then the number of rows above and below the middle row. For instance, an oval with 16 ’*”s in the middle row and 2 rows above and below will have 12 *s centered in the top row, 14 *s centered in the second row, 16 *s in the middle row, 14 *s centered in the fourth row, and 12 *s centered in the bottom row.
No row is allowed to have less than 2 *s.
I have to use nested for loops for this and I can't figure it out. Thanks!
Explanation / Answer
#include int main() { int n, c, k, space = 1; printf("Enter number of rows "); scanf("%d", &n); space = n - 1; for (k = 1; kRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.