Hi,

There's one misstake in your code,

One of the "div"s should be a "mod"

Here's a modifyed version of your code

var i: integer;

type string10 = string[10];

const

ones: array[0..9] of string10 = ('', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');

tens: array[0..9] of string10 = ('','ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety');

function wordnumber (number: word) : string;

begin

wordnumber:= tens [number div 10] + '-' +ones [number mod 10];

end;

begin {main}

for i:= 20 to 99 do

writeln ('You write ',i, ' like this: ', wordnumber(i));

end.

There's one misstake in your code,

One of the "div"s should be a "mod"

Here's a modifyed version of your code

var i: integer;

type string10 = string[10];

const

ones: array[0..9] of string10 = ('', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');

tens: array[0..9] of string10 = ('','ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety');

function wordnumber (number: word) : string;

begin

wordnumber:= tens [number div 10] + '-' +ones [number mod 10];

end;

begin {main}

for i:= 20 to 99 do

writeln ('You write ',i, ' like this: ', wordnumber(i));

end.