Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include int main(void) { int numOranges = 0; double costOranges = .67; double weightBananas = 0.0; double costBananas = .59; double total = 0.0; printf(Enter

  1. #include
  2. int main(void)
  3. {
  4. int numOranges = 0;
  5. double costOranges = .67;
  6. double weightBananas = 0.0;
  7. double costBananas = .59;
  8. double total = 0.0;
  9. printf("Enter number of oranges: "); //user enters 2
  10. scanf("%d", & numOranges);
  11. printf("Enter weight of bananas: "); //user enters 3.4
  12. scanf("%lf", & weightBananas);
  13. total = costBananas * weightBananas + costOranges * numOranges;
  14. printf("Total is equal to: $%.2lf ", total);
  15. return 0;
  16. }

 1. numOranges instantiated with value 0 costOranges instantiated with value .67 weightBananas instantiated with value 0.0 costBananas instantiated with value .59 total instantiated with value 0.0 2 read from screen and stored in numOranges 3.4 read from screen and stored in weightBananas total = 67 * 2 + .59 * 3.4 "Total is equal to: $3.35" is output to screen followed by a new line ______________________________________________________________________________ 2. numOranges instantiated with value 0 costOranges instantiated with value .67 weightBananas instantiated with value 0.0 costBananas instantiated with value .59 total instantiated with value 0.0 user prompted to enter number of oranges user entered value read from screen and stored in numOranges user prompted to enter weight of bananas user entered value read from screen and stored in weightBananas costBananas multiplied by weightBananas and added to the result of multiplying costOranges by numberOfOranges, the result of the calculation is assigned to total "Total is equal to: $3.35" is output to screen followed by a new line _____________________________________________________________________________ 3. numOranges instantiated with value 0 costOranges instantiated with value .67 weightBananas instantiated with value 0.0 costBananas instantiated with value .59 total instantiated with value 0.0 user prompted to enter number of oranges 2 read from screen and stored in numOranges user prompted to enter weight of bananas 3.4 read from screen and stored in weightBananas total = .59 * 3.4 + .67 * 2 "Total is equal to: $3.35" is output to screen followed by a new line _____________________________________________________________________________ 4.user prompted to enter number of oranges user entered value read from screen and stored in numOranges user prompted to enter weight of bananas user entered value read from screen and stored in weightBananas costOranges multiplied by numOranges and promoted to double and added to the result of multiplying costBananas by weightBananas, the result of the is assigned to total "Total is equal to: $3.35" is output to screen followed by a new line 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions