Write a C program to find the sum of first 10 natural numbers.

Write a C program to find the sum of first 10 natural numbers.

Q:-Write a C program to find the sum of first 10 natural numbers.

#include<stdio.h>
#include<conio.h>
void main() 
 {
    int sum = 0;

    for(int i = 1; i <= 10; i++) {
        sum = sum+ i;
    }

    printf("The sum of the first 10 natural numbers is: %d\n", sum);

    getch();
}

Output

TOP