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