Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help writing a program that accepts an integer value (I.E 5) and outputs

ID: 3639431 • Letter: I

Question

I need help writing a program that accepts an integer value (I.E 5) and outputs a number of shapes that represents that value. Here is an example:

A. a line of 'x' asterisks, e.g., if 'x' entered is 5,

*****

B. a sqaure block of asterisks, 'x' by 'x,' e.g., if 'x' entered is 5,

*****
*****
*****
*****
*****

C. an upside-down right triangle, e.g., if 'x' entered is 5,

*****
****
***
**
*

D. a number of right triangles, from the smallest one (height of 1) to
the largest (height of 'x'); e.g., if 'x' entered is 5,

*

*
**

*
**
***

*
**
***
****

*
**
***
****
*****

Can someone help me out with this? thanks!

Explanation / Answer

Here is the perfect code for your question! A. #include int main() { int x,i; printf(" enter no. of asterisks to be printed "); scanf("%d",&x); for(i=0;i