Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int num = 0;
- int f = 0;
- int b = 0;
- int c = 0;
- int r = 0;
- int main() {
- setlocale(LC_ALL, "ru");
- cout << "Введите число "<< endl;
- cin >> num;
- /*if (99 < num && num < 999)
- {
- f = num % 10;
- b = (num / 10) % 10;
- c = num / 100;
- c = c * 4;
- b = b * 2;
- f = f * 1;
- cout << f + b + c << endl;
- }*/
- if (999 <= num <= 9999) { //для четырехзначных
- f = num % 100;
- b = (num / 10) % 10;
- c = (num / 100) % 10;
- r = num / 1000;
- c = c * 6;
- b = b * 4;
- f = f * 2;
- r = r * 1;
- cout << f + b + c + r << endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement