Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- int N;
- scanf("%d", &N);
- float vneseni = N;
- float prosti = 0;
- for(int i = 0; i < N; i++) {
- int x;
- scanf("%d", &x);
- int prost = 1;
- for(int j = 2; j < x; j++) {
- if(x % j == 0) {
- prost = 0;
- }
- }
- if(prost == 1) {
- printf("%d ", x);
- prosti++;
- }
- }
- printf("%f ", (prosti / vneseni) * 100);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement