Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(){
- int A, B, k;
- scanf("%d%d%d", &A, &B, &k);
- int zbir = 0;
- for(int i = A; i <= B; i++) {
- int deliteli_na_i = 0;
- for(int j = 1; j <= i; j++) {
- if(i % j == 0) {
- deliteli_na_i++;
- }
- }
- int k_deliv = 1;
- for(int j = i - 1; j >= i - k; j--) {
- if(j >= 1) {
- int deliteli_na_prethodnikot = 0;
- for(int x = 1; x <= j; x++) {
- if(j % x == 0) {
- deliteli_na_prethodnikot++;
- }
- }
- if(deliteli_na_i <= deliteli_na_prethodnikot) {
- k_deliv = 0;
- }
- }
- }
- if(k_deliv == 1) {
- zbir += i;
- }
- }
- printf("%d\n", zbir);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement