Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* T2 zadatak 10 - Napisati program koji ispituje da li je dati
- prirodan broj n prost. Broj je prost ako je deljiv
- samo sa jedan i sa samim sobom. */
- #include<stdio.h>
- int main()
- {
- int n, c = 2;
- printf("Unesite broj:\n");
- scanf("%d",&n);
- for (c = 2;c<=n-1;c++)
- {
- if (n%c==0)
- {
- printf("%d nije prost.\n", n);
- break;
- }
- }
- if (c==n)
- printf("%d je prost.\n", n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment