fork download
  1. #include <stdio.h>
  2.  
  3. int parOuImpar(int valor, int *quantidade) {
  4. if (valor % 2 == 0) {
  5. (*quantidade)++;
  6. return 1;
  7. } else return 0;
  8. }
  9.  
  10. int main(){
  11. int num;
  12. scanf("%d", &num);
  13. int quantidade = 0;
  14. if (parOuImpar(num, &quantidade)) printf("O dado é par e isto ocorreu %d vezes", quantidade);
  15. else printf("O dado é impar");
  16. }
  17.  
  18. //https://pt.stackoverflow.com/q/387048/101
Success #stdin #stdout 0s 9424KB
stdin
4
stdout
O dado é par e isto ocorreu 1 vezes