Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Problems The following C code allows the user to draw a half pyramid of n number of rows using the * character. The minimum

Programming Problems

The following C code allows the user to draw a half pyramid of n number of rows using the * character. The minimum and the maximum number of rows are 2 and 10 respectively.

#include int main() { int rows = 0; do{ printf("please enter the number of rows: "); scanf("%d",&rows); }while(rows <=2 ); printf("printing a half pyramid of %d rows", rows); printf(" ");

for(int i =1; i for (int j =1; j <=rows; j++){ printf("* "); } } return 0; }

Questions

Q1] Compile and run the code as it is, and report any problem you noticed

Q2] Fix the code, so that the user can use it to print a half pyramid of n number of rows using the * character, remember the minimum and the maximum number of raws are 2 and 10 respectively.

Q3] After fixing the code could you modify the code to rather than using the * character it uses numbers when drawing the pyramid as showing in the sample outputs 3 and 4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago