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.
Comments
Leave a comment