Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #include <math.h>
- int eprost(int broj) {
- int brojac = 0;
- for(int i = 1; i <= broj; i++) {
- if(broj % i == 0) {
- brojac++;
- }
- }
- if(brojac == 2) {
- return 1;
- }
- else {
- return 0;
- }
- }
- int funkcija(int *niza, int n) {
- int ok = 1;
- for(int i = 0; i < n; i++) {
- if(eprost(niza[i]) == 0) {
- ok = 0;
- }
- }
- if(ok == 1) {
- return 1;
- }
- else {
- return 0;
- }
- }
- int main(int argc, char * argv[]) {
- int n;
- scanf("%d", &n);
- int niza[n];
- for(int i = 0; i < n; i++) {
- scanf("%d", &niza[i]);
- }
- int rezult = funkcija(niza, n);
- printf("%d\n", rezult);
- }
- /*
- 6
- 2 4 5 7 11 23
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement