Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication5.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <cmath>
- using namespace std;
- int f(int x)
- {
- if (x / 10000 == 0)
- return ((x % 1000) % 100) % 10;
- else
- if (x / 1000 == 0)
- return (x % 100) % 10;
- else
- if (x / 100 == 0)
- return x % 10;
- else
- return x;
- }
- int main()
- {
- int z, a, b;
- cout << "Vvedite a \t";
- cin >> a;
- cout << "Vvedite b \t";
- cin >> b;
- z = f(a) + f(b);
- cout << z << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement