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

I need help writing this program. Please use vertical and horizontal spacing; th

ID: 3625068 • Letter: I

Question

I need help writing this program. Please use vertical and horizontal spacing; this is a C program (not C++)


Write a program that will prompt the user for how many times your program should loop.

Store the result in the int variable howmany

Set sum equal to 0

Set counter equal to 1

While (counter is less than or equal to howmany)

sum = sum + counter

counter = counter + 1

End loop

(Notice that even though you will be writing a for loop the pseudocode uses a while loop structure)

Tell the user the sum of the numbers 1 to howmany equals sum

Thank the user for using your program

Exit your program with a return statement

Explanation / Answer

please rate - thanks

#include <stdio.h>
#include <conio.h>
int main()
{int howmany,sum=0,counter;
printf("How many times to loop? ");
scanf("%d",&howmany);
for(counter=1;counter<=howmany;counter++)
    sum=sum+counter;
    printf("The sum of the numbers from 1 to %d is %d ",howmany,sum);
getch();
return 0;
}