#include <stdio.h>

int main()
{
    int i,n1,sum;
    printf("Enter a number of natural numbers:\n");
    scanf("%d",&n1);
    for (i=1;i<n1;++i)
        {printf("%d\n",i);
        sum+=i;}
    printf("the sum of natutral numbers is\n");
    printf("%d",sum);
    
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: