fork download
  1. #include<stdio.h>
  2. #include<math.h>
  3. int main()
  4. {
  5. int i,s,n;
  6. s=0;
  7. scanf("%d",&n);
  8. do
  9. {
  10. s=s+i;
  11. i++;
  12. }
  13. while(i<=n);
  14. printf("%d",s);
  15. return 0;
  16. }
Success #stdin #stdout 0s 5476KB
stdin
4
stdout
4