Advertisement
M_Cracked

lista 4 ex 8

Feb 17th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2. int main(){
  3. int vetor[10];
  4. int a,neg,soma;
  5. neg=0;
  6. soma=0;
  7. for (a=0 ; a<10 ; a++){
  8. scanf("%d",&vetor[a]);
  9. }
  10. for (a = 0 ; a < 10 ; a++){
  11. if(vetor[a] < 0){
  12. neg++;
  13. }
  14. else{
  15. soma=soma+vetor[a];
  16. }
  17. }
  18. printf("%d numeros negativos\n", neg);
  19. printf("%d", soma);
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement