Advertisement
damch

Specijalni proti broevi

Dec 6th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int
  4. main ()
  5. {
  6. int m, n, i, j;
  7. int broj, broj1, pom, cifra, suma = 0, broj2 = 0;
  8. scanf ("%d %d", &m, &n);
  9. if (m < n)
  10. {
  11. for (i = m + 1; i < n; i++)
  12. {
  13. broj = 0;
  14. broj1 = 0;
  15. for (j = 1; j <= i; j++)
  16. {
  17. if (i % j == 0)
  18. broj++;
  19. }
  20. pom = i;
  21. while (pom > 0)
  22. {
  23. cifra = pom % 10;
  24. if (cifra % 2 == 0)
  25. broj1++;
  26.  
  27. pom /= 10;
  28. }
  29.  
  30. if (broj == 2 && broj1 >= 1)
  31. {
  32. printf ("%d\n", i);
  33. suma += i;
  34. broj2++;
  35. }
  36. }
  37. printf ("%.3f", 1.suma / broj2);
  38.  
  39.  
  40.  
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement