Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <math.h>
- #include <stdio.h>
- #include <locale.h>
- #define _CRT_SECURE_NO_WARNINGS
- int main() {
- setlocale(0, "russian");
- int n, p;
- printf("Введите натуральное число N, не равное 1 \n");
- scanf_s("%d", &n);
- p = 2;
- printf("Введено число %d \n", n);
- printf("Разложение числа на простые множители: ");
- for (p = 2; n > 1; ++p) {
- if (n % p == 0) {
- while (n % p == 0) {
- n = n / p;
- printf("%d ", p);
- }
- }
- }
- 2
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement