Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://vk.com/evgenykravchenko0
- ___ ___ ___
- / /\ ___ / /\ / /\
- / /:/_ /__/\ / /:/_ / /:/_
- / /:/ /\ \ \:\ / /:/ /\ / /:/ /\
- / /:/ /:/_ \ \:\ / /:/_/::\ / /:/ /:/_
- /__/:/ /:/ /\ ___ \__\:\ /__/:/__\/\:\ /__/:/ /:/ /\
- \ \:\/:/ /:/ /__/\ | |:| \ \:\ /~~/:/ \ \:\/:/ /:/
- \ \::/ /:/ \ \:\| |:| \ \:\ /:/ \ \::/ /:/
- \ \:\/:/ \ \:\__|:| \ \:\/:/ \ \:\/:/
- \ \::/ \__\::::/ \ \::/ \ \::/
- \__\/ ~~~~ \__\/ \__\/
- ___
- /__/\ ___ ___
- \ \:\ / /\ / /\
- \ \:\ / /:/ / /:/
- _____\__\:\ /__/::\ /__/::\
- /__/::::::::\ \__\/\:\__ \__\/\:\__
- \ \:\~~\~~\/ \ \:\/\ \ \:\/\
- \ \:\ ~~~ \__\::/ \__\::/
- \ \:\ /__/:/ /__/:/
- \ \:\ \__\/ \__\/
- \__\/
- #include <stdio.h>
- #include <conio.h>
- //-— функция —-
- int Simple ( int N )
- {
- for ( int i = 2; i*i <= N; i ++ )
- {
- if ( N % i == 0 )
- return 0;
- }
- return 1;
- }
- int main()
- {
- int i;
- int N;
- int count = 0;
- printf("Введите значение N : ");
- scanf("%d", &N);
- for (i = 1;i <= N;i++)
- {
- if (Simple(i))
- {
- count += 1;
- printf("%d \n", i);
- }
- }
- printf("Всего %d простых чисел в последовательности от 1 до %d ", count, N);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement