Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- int number, i, n = 0, srt;
- printf("Number: ");
- scanf("%d", &number);
- srt = (int)sqrt(number) + 1; // корен квадратен
- for (i = 2; i <= srt; i++)
- {
- if (number % i == 0)
- {
- n = 1;
- break;
- }
- }
- if (n == 0)
- {
- printf("Number %d is prime.", number);
- }
- else
- {
- printf("Number %d is not prime.", number);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement