fork download
  1. #!/bin/bash
  2. while true
  3. do
  4. read line
  5. if [ $line -eq 42 ]
  6. then
  7. exit 0
  8. fi
  9. echo $line
  10. done
  11.  
  12. #include <stdio.h>
  13.  
  14. int main()
  15.  
  16. int num = 1, x= 0;
  17.  
  18. for (int i = 0; i <5; i++){
  19.  
  20. scanf("%d", &x);
  21.  
  22. // onde % e retorna o resto da divisão por algum número
  23.  
  24. if (x % 3 == 0) {
  25.  
  26. num = num + 1;
  27.  
  28. Jelse {
  29.  
  30. num = num + x;
  31.  
  32. }
  33.  
  34. }
  35.  
  36. printf("num = %d", num);
  37.  
  38. return 0;
  39.  
  40. }
Success #stdin #stdout 0.01s 5288KB
stdin
1
2
10
42
11
stdout
1
2
10