Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int a, b;
- scanf("%d", &a);
- scanf("%d", &b);
- int zbir = 0;
- for(int i = a; i <= b; i++) {
- int broj_na_deliteli_na_i = 0;
- // tuka presmetuvame kolku deliteli ima brojot i
- for(int j = 1; j <= i; j++) {
- if(i % j == 0) {
- broj_na_deliteli_na_i++;
- }
- }
- //otkako ke presmetame kolku deliteli ima brojot i, moze da proverime dali e prost
- if(broj_na_deliteli_na_i == 2) {
- zbir += i;
- }
- }
- printf("%d\n", zbir);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement