Computer Science, asked by sabarichowdhuri2667, 3 days ago

Write a program to find the sum of 20 numbers

Answers

Answered by jvsonawane2008
0

#include <stdio.h>

int main() {

int n, i, sum = 0;

printf("Enter a positive integer: ");

scanf("%d", &n);

for (i = 1; i <= n; ++i) {

sum += i;

}

printf("Sum = %d", sum);

return 0;

}

Similar questions