Advertisement
Josif_tepe

Untitled

Nov 12th, 2023
891
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.86 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5. #include <math.h>
  6.  
  7.  
  8. int main(int argc, char * argv[]) {
  9.     int x;
  10.    
  11.     while(scanf("%d", &x)) {
  12.         int tmp = x;
  13.         if(x < 10) {
  14.             printf("Ne mozhe da se formira dvocifren broj\n");
  15.         }
  16.         else {
  17.             int prva, posledna;
  18.             posledna = x % 10;
  19.             while(x > 9) {
  20.                 x /= 10;
  21.             }
  22.             prva = x;
  23.             int zbir = prva + posledna;
  24.             if(zbir < 10) {
  25.                 printf("Ne mozhe da se formira dvocifren broj\n");
  26.             }
  27.             else {
  28.                 int proizvod = (zbir % 10) * (zbir / 10);
  29.                 if(proizvod % 2 == 0) {
  30.                     printf("%d ", tmp);
  31.                 }
  32.             }
  33.            
  34.         }
  35.     }
  36.     return 0;
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement