Advertisement
CSenshi

Sum of n numbers

Mar 30th, 2019
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.22 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(int argc, char *argv[]){
  4.     int x;  scanf("%d", &x);
  5.     int sum = 0;
  6.     for(int i = 0 ; i < x; i++){
  7.         int a;  scanf("%d", &a);
  8.         sum += a;
  9.     }
  10.     printf("sum : %d\n", sum);
  11.        return 0;
  12.  
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement