Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. void fatora(int n)
  2. //Recebe um número, realiza divisões sucessivas desse número pelo seus fatores
  3. //primos, conta a quantidade de vezes que dividiu o número por cada fator e
  4. //então imprime no formato "nxf".
  5. {
  6. int c = 2, fator, cont = 0;
  7. for (c = 0; c < n; c++) {
  8. fator = proximo_primo(c);
  9. while (n % fator == 0) {
  10. n = n / fator;
  11. cont++;
  12. }
  13. if (cont >= 1) {
  14. printf("%dx%d\n", cont, proximo_primo(c));
  15. }
  16. cont = 0;
  17. }
  18. return;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement