DarthVictor

Untitled

Sep 6th, 2011
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. //This code is a exercise of SPOJ http://br.spoj.pl/
  2. //This code was developed by Victor Mello Floriano
  3.  
  4.  
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7.  
  8. int main()
  9. {
  10. int x[50];
  11. int quant;
  12. scanf("%d",&quant);
  13.  
  14. int i, soma=0;
  15.  
  16. for(i = 0;i<quant;i++)
  17. {
  18.     scanf("%d",&x[i]);
  19.     if(x[i]<0){x[i]=x[i]*-1;}
  20.     soma = soma + x[i];
  21. }
  22.  
  23. printf("%d",soma);
  24.  
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment