← Back to topics
Topic

paycheck

s
sole90
Can you tell me, if I'm not asking much, where did i do wrong in my solution for this problem on past competition? Tnx
a
adminModerator
The problem is in the following line:
writeln(s1/s2:0:2);

the division there is integer division - meaning if you have s1 = 3 and s2 = 1 you will get s1/s2 = 1 and not 1.5
s
sole90
But on my computer it displayed real numbers
a
adminModerator
Well, it depends what compiler you are using. But according to standard pascal, it should NOT display real numbers.
t
tgudlek
AFAIK, 3/1 is 1 :P
s
sole90
BUt it did, not my fault. Never mind.
o
oduleodule
Miloše,

Your mistake is: You were used integer type in your code. This is not enough to receive all data in s1 and s2.

Put LongInt instead, and I'm sure that then will be OK.