write a c program to print all the numbers from 1 to 100 and find their sum.

write a c program to print all the numbers from 1 to 100 and find their sum.

About the author
Vivian

1 thought on “write a c program to print all the numbers from 1 to 100 and find their sum.”

  1. #include<stdio.h>

    int main()

    {

    int sum=0;

    for(int i=1; i<=100; i++)

    {

    printf(“%d “,i);

    sum = sum + i;

    }

    printf(“\nSum = %d\n”,sum);

    return 0;

    }

    Reply

Leave a Comment