// sum upto given number
#include <stdio.h>
int main() {
int sum=0,n;
printf("Enter number upto which you need the sum : ");
scanf("%d",&n);
printf("\n");
for(int i=1,j=n;i<=n && j>=1;i++,j--){
sum = sum + i; //sum+=i
printf("%d\n",j);
}
printf("sum is %d\n",sum);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: