Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- const int kopInGrn{ 100 };
- double sum{64.70};
- int grn;
- int kop;
- std::cout << "Enter the summ: ";
- std::cin >> sum;
- // Variant A - simpler to understand how it works
- //kop = sum * kopInGrn;
- //grn = kop / kopInGrn;
- //kop %= kopInGrn;
- // Variant B - shorter :)
- grn = sum;
- kop = (sum - grn) * kopInGrn;
- std::cout << "The summ is equal: " << grn << " grn. " << kop << " kop.\n";
- return 0;
- }
Add Comment
Please, Sign In to add comment