Answer to Question #185952 in C++ for shuvo

Question #185952

The following mathematical expression is used to find the number of penny stamps one gets if one inserts dollars number of dollars in a stamp vending machine that returns the change in penny stamps. Replace the given mathematical expression by a simpler expression that gives the same value.

double amount = 19.35;

double amount = 19.95;

What are values of variables a and b after the following assignments?

int a = amount2;

int b = amount2 + 0.5; 


1
Expert's answer
2021-04-27T00:02:39-0400
#include <iostream>

using namespace std;

int main(){  

	double numberDollar=20;
	double numberPennyStamps= numberDollar - 0.5;


	cout<<numberPennyStamps<<"\n";


	double amount1 = 19.35;
	double amount2 = 19.95;
	
	int a = amount2;
	int b = amount2 + 0.5;


	cout<<"a = "<<a<<"\n";
	cout<<"b = "<<b<<"\n";
	

	return 0;
}

Output:
a = 19
b = 20

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS