Menu

Add Topic

programming

waiting answer July 28, 2021

Write a C Program to Display First 10 Natural Numbers and Their Sum

Answers
January 20, 2021
    #include<stdio.h>
    int main()
    {
        int i,sum=0;
        for(i=1;i<=10;i++)
        {
            printf("\nNo = %d",i);
            sum=sum+i;
        }
        printf("\nSum of 10 natural numbers is = %d",sum);
        return 0;
    }   
 

OUTPUT

        No = 1
        No = 2
        No = 3
        No = 4
        No = 5
        No = 6
        No = 7
        No = 8
        No = 9
        No = 10
        Sum of 10 natural numbers is = 55

0 0

Please Login to Post the answer

Leave an Answer