fork download
  1. #include <stdio.h>
  2.  
  3. void totalsum(){
  4. int n,sum;
  5. scanf("%d",&n);
  6. sum=0;
  7. for(int i=1;i<=n;i++){
  8. sum+=i;}
  9. printf("%d",sum);}
  10. int main(){
  11. totalsum();
  12. return 0;}
  13.  
Success #stdin #stdout 0s 544KB
stdin
2
5
1
1
1
1
6
2
1
3
stdout
3