Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #include <stdlib.h>
- #include <math.h>
- int prime(int *tomb, int db)
- {
- int i, j, primszam=1;
- for(i=0;i<db;i++)
- {
- if(tomb[i] < 2)
- {
- return 0;
- }
- for(j=2;j<=sqrt(tomb[i]);j++)
- {
- if(tomb[i]%j==0)
- {
- primszam = 0;
- }
- }
- if(primszam == 1)
- return 1;
- else
- return 0;
- }
- }
- int main()
- {
- int db=5, i, j;
- int szamok[5] = {2, 3, 4, 5, 7};
- printf(prime(szamok, db) ? "YES\n " : "NO\n");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement