Advertisement
myname0

37.I.2

Mar 31st, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int function ( int N)
  6. {
  7. int Sum = 0;
  8. while (N>0)
  9. {
  10. Sum += (N % 10);
  11. N/=10;
  12. }
  13. return Sum;
  14. }
  15. void Count ( int a, int b)
  16. {
  17. int g;
  18. for ( int i=a; i<=b; i++)
  19. {
  20. g = function (i);
  21. if ( g % 2 == 1)
  22. cout << i << " ";
  23. }
  24. }
  25.  
  26. int main ()
  27. {
  28. int a;
  29. int b;
  30. cout << " Enter numbers: ";
  31. cin >> a >> b;
  32. Count( a, b);
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement