fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int n ,sum =0;
  5. printf("enter a number:" );
  6. scanf("%d",&n);
  7. for(int i=0;i<=n;i++)
  8. {sum=sum+i;}
  9. printf("sum from 0 to %d is:%d\n",n,sum);
  10. // your code goes here
  11. return 0;
  12. }
  13.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
enter a number:sum from 0 to 32767 is:536854528