If you are using FreePascal, you can use FormatFloat function: FormatFloat('0.00', Val);
. If you are using old TP use formatting with Write/WriteLn like this: WriteLn(Val:0:2);
.
How to change scientific outcome in "normal" number?
Frage
When I was making my first exercises in PASCAL I came across a very large (scientific) outcome. I asked my coach from course how to fix this. He didn't know the answer.
I searched on Google how to convert this, but no luck finding the right answer. So I thought lets ask here.
The outcome is "2.150000000E+02". Anyone knows how to convert this into normal number like 2150 (or something like that)
PS: The code as requested:
//
program LOON;
var uren,overuren,bruto: integer;
begin
//
writeln('Geef uren, uurloon en overuren in');
//
readln(UREN,OVERUREN,BRUTO);
//
writeln('Het effectieve loon bedraagt' ,(UREN+OVERUREN*1.5)*BRUTO);
//
writeln();
//
writeln('Druk op <ENTER> om het programma te verlaten');
//
readln();
writeln();
writeln('Druk op <ENTER> om het programma te verlaten');
readln():;
end.
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow