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

Here are my instructions for the assignment: Write a program that reads a positi

ID: 3616728 • Letter: H

Question

Here are my instructions for the assignment:

Write a program that reads a positive integer value for "n" andthen sums up the integers from n to 2*n.

Here is my code so far:


include <stdio.h>

int main(void)
{
        int n, sum; /* Variablen*/
        printf("Please enter apositive integer: ");
        scanf("%d",&n);

               for (n >= 0; n <= 2*n; ++n)
               {
               sum = sum + n;
               }
               printf("%dsum", sum);
return 0;
}

I really need this program to work, and I can't figure out why itis not working: Here is my error log when trying to compile:

ch3.10.c:1: error: syntax error before '<' token
ch3.10.c:6: error: syntax error before string constant
ch3.10.c:6: warning: conflicting types for built-in function'printf'
ch3.10.c:6: warning: data definition has no type or storageclass
ch3.10.c:7: error: syntax error before string constant
ch3.10.c:7: warning: conflicting types for built-in function'scanf'
ch3.10.c:7: warning: data definition has no type or storageclass
ch3.10.c:14:24: warning: unknown escape sequence 's'
ch3.10.c:14: error: syntax error before string constant
ch3.10.c:14: warning: data definition has no type or storageclass


Giving MAX POINTS!!!






Explanation / Answer

please rate - thanks #include #include int main(void) {         int n,i, sum=0; /*Variable n*/         printf("Please enter apositive integer: ");         scanf("%d",&n);                for (i = n; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote