Question: Problem Statement Please modify the following code to use only the DO - WHILE loops. The program prompts a user for an integer input. It

Problem Statement
Please modify the following code to use only the DO-WHILE loops. The program prompts a user for an integer input. It takes an input as a size of a triangle. The program will output the triangle to the screen.
#include
int main()
{
int size =0;
int i =0;
int j =0;
//prompt a user for an input
printf("Please input an int as a size of a triangle: ");
scanf("%d", &size);
//output a triangle to the screen
printf("
*****Print triangle*****
");
for( ;i < size; i++){
j = i+1;
while(j-->0){
printf("#");
}
printf("
");
}
return 0;
}
Output example
Please input an int as a size of a triangle: 5
*****Print triangle*****
#
##
###
####
#####
Partial Solution
Please try to implement the assignment code in your IDE first and compare your source code with the following partial solution code. Complete the following code for the assignment credit.
#include
int main()
{
int size =0;
int i =0;
int
j
=0;
//prompt a user for an input
printf("Please input a int as a size of a triangle: ");
scanf("%d",
&size
);
//output a triangle to the screen
printf("
*****Print triangle*****
");
do
{
j = i+1;
while
{
printf("#");
}
(--j
0);
printf("
");
}
(++i
size )
return
;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!