metalni

whatever 2 in C

Nov 10th, 2020 (edited)
964
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void){
  4.     int a, b, tmp, sum, count=0;
  5.     scanf("%d %d", &a, &b);
  6.  
  7.     for(int i=a; i<=b; i++){
  8.         tmp = i;
  9.         sum = 0;
  10.         while(tmp){
  11.             if((tmp%10)%2==0 && (tmp%10)%3!=0)
  12.                 sum += tmp%10;
  13.             tmp /= 10;
  14.         }
  15.         if(sum>0 && sum%7 == 0){
  16.             printf("%d\n", i);
  17.             count++;
  18.         }
  19.     }
  20.     printf("Vkupno: %d", count);
  21. }
Add Comment
Please, Sign In to add comment