Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
275 B
10
Indexable
Never
#include <stdio.h>
int main() {
    int n, i, sum = 0;
    
    if (n=i)
    {
        print("n equals i");
    }
    printf("Enter a positive integer: ")
    scanf("%d", n);

    for (i = n; i < 0; i--) {
        sum += i;
    }

    printf("Sum = %d", sum);
    return 0;
}
Leave a Comment