60 371
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #17299 in Delphi | Pascal for Edgars

Question #17299
Input the price N (whole dollars), input customer given banknote (100 or 50). Offer customer pay extra so that minimum change will be 5.
Expert's answer
The program is written in Pascal. If you are using Delphi or Lazarus,& paste it where it is needed.


program Change;
var
N,b:integer;
begin
N:=0;b:=0;&
writeln('Please enter price N:');
readln(N);
writeln('Please choose 50 or 100 banknotes');
readln(b);
if (b=50) or (b=100) then
& begin
& writeln('Let''s suppose, you gave ',(N div b)+1,' (',b,'$) banknotes');
& if (((N div b)+1)*b-N<5) then
begin
writeln('The change is ',((N div b)+1)*b-N,'$',' and is less than 5$');
writeln('Please add extra ',b,'$ banknote');
end
& else writeln((N div b)+1,' banknotes are okey. The change is more than 5$');
& end;
& readln;
end.

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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions