Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5.  
  6. int coletinho(int a, int Bb, int contaBalas)
  7. {
  8. if (a % Bb == 0 && Bb % 3 == 0)
  9. {
  10. ++contaBalas;
  11. }
  12.  
  13. if (Bb <= 2)
  14. {
  15. return contaBalas;
  16. }
  17.  
  18. return coletinho(a, --Bb, contaBalas);
  19.  
  20. }
  21.  
  22. int main()
  23. {
  24. int a, div3, pinturao;
  25.  
  26. scanf("%d", &a);
  27.  
  28. pinturao = a;
  29.  
  30. div3 = coletinho(a, pinturao, 0);
  31.  
  32. if (div3 != 0)
  33. {
  34. printf("%d", div3);
  35. }
  36. else
  37. {
  38. printf("O numero nao possui divisores multiplos de 3!");
  39. }
  40.  
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement