Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. // ConsoleApplication5.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <cmath>
  7. using namespace std;
  8. int f(int x)
  9. {
  10. if (x / 10000 == 0)
  11. return ((x % 1000) % 100) % 10;
  12. else
  13. if (x / 1000 == 0)
  14. return (x % 100) % 10;
  15. else
  16. if (x / 100 == 0)
  17. return x % 10;
  18. else
  19. return x;
  20. }
  21. int main()
  22. {
  23. int z, a, b;
  24. cout << "Vvedite a \t";
  25. cin >> a;
  26. cout << "Vvedite b \t";
  27. cin >> b;
  28. z = f(a) + f(b);
  29. cout << z << endl;
  30. system("pause");
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement