13.07.2015 Views

A practical introduction to Pascal programming language - GIARA

A practical introduction to Pascal programming language - GIARA

A practical introduction to Pascal programming language - GIARA

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Alternative constructionsExercise 2.7. Write a program that reads a real number from the keyboard. Then, if the numberis in the interval [−5, 5], it displays the message Within!. Otherwise, it displays the messageOutside.□The first of the options consists of checking that the number is greater than −5 and smallerthan 5.Program 23: Exercise 2.7 (Version A)program c02e07;varvalue:real;beginwrite(’Input a number: ’);readln(value);(* Basic double comparison*)if (-5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!