Advertisement
Spocoman

Fruit Market

Sep 19th, 2023
1,057
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     double strawberriesPrice, bananasKg, orangesKg, raspberriesKg, strawberriesKg;
  8.     cin >> strawberriesPrice >> bananasKg >> orangesKg >> raspberriesKg >> strawberriesKg;
  9.  
  10.     double raspberriesPrice = strawberriesPrice / 2;
  11.     double orangesPrice = raspberriesPrice * 0.6;
  12.     double bananasPrice = raspberriesPrice / 5;
  13.  
  14.     double totalSum = strawberriesPrice * strawberriesKg + bananasPrice * bananasKg + orangesPrice * orangesKg + raspberriesPrice * raspberriesKg;
  15.  
  16.     cout << fixed << setprecision(2) << totalSum << endl;
  17.  
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement