fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int I ,n, sum ;
  5. printf("Enter the size:\n");
  6. scanf("%d", &n);
  7. int a[n];
  8. printf("Enter the elements:\n");
  9. for( I= 0 ; I<n; I++)
  10. scanf("%d",&a[I]);
  11. sum=0;
  12. for( I=0; I<n; I++)
  13. sum=sum+(a[I]);
  14. printf("Sum=%d",sum);
  15. return 0;
  16.  
  17. }
  18.  
Success #stdin #stdout 0s 4520KB
stdin
Standard input is empty
stdout
Enter the size:
Enter the elements:
Sum=0