#include <stdio.h>

int main() {
    int n;
    printf("enter a no. \n");
    scanf("%d \n",&n);
    
    int sum=0;
    for (int i=1, j=n; i<=n && j>=1; i++, j--)
    { 
        sum = sum + i;
        printf("%d \n",j);
        
    }
    printf("sum is : %d",sum);

    return 0;
}

Embed on website

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