Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int n;
- int fator;
- int expoente;
- printf("Que numero quer decompor?");
- scanf("%d", &n);
- printf("Decomposicao de %d em fatores primos:\n", n);
- fator = 2;
- while (n > 1)
- {
- expoente = 0;
- while (n % fator == 0)
- {
- expoente ++;
- n = n / fator;
- }
- if (expoente != 0)
- {
- printf(" %d elevado a %d \n", fator, expoente);
- }
- fator++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment