Question: #include int main(void) { int numOranges = 0; double costOranges = .67; double weightBananas = 0.0; double costBananas = .59; double total = 0.0; printf(Enter
- #include
- int main(void)
- {
- int numOranges = 0;
- double costOranges = .67;
- double weightBananas = 0.0;
- double costBananas = .59;
- double total = 0.0;
- printf("Enter number of oranges: "); //user enters 2
- scanf("%d", & numOranges);
- printf("Enter weight of bananas: "); //user enters 3.4
- scanf("%lf", & weightBananas);
- total = costBananas * weightBananas + costOranges * numOranges;
- printf("Total is equal to: $%.2lf ", total);
- return 0;
- }
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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
