Pascal programming language : exercises / PDF


Pascal programming language : exercises / PDF




Pascal programming language : exercises / PDF








Sample of the PDF document 






4. Change the program in exercise 3 such that, for each variable, the following is displayed:
Example: Variable contains variable content

5. · Declare a STRING variable called MyName
· Set MyName to your name
· Display ‘Hello your_name’ at the centre of the screen

6. · Declare two STRING variables: Name and Surname
· Declare an INTEGER variable: Age
· Assign to Name and Surname your name and surname
· Assign your age to Age
· Display the following:
Hello – my name is name surname.
blank line
I am age years old.

7. How many columns and rows are there in the output screen?
columns: ________________ rows: _________________

8. Modify the program in exercise 5 so that the text is displayed at the centre of the screen inside a box, thus:
Hello, my name is name surname.
blank line
I am age years old.
Note: to type box component characters, keep the Left ALT tab pressed and type in the character’s ASCII
code on the numeric keypad.

9.Write a program that:
· Prompts the user to enter her name
· Clears the screen
· Displays ‘Hello name’ at the centre of the screen

10. Write a program that:
· Prompts the user to enter two words
· Clears the screen
· Displays the concatenation of the words
E.g.: if the user enters ‘Table and ‘soccer’, the program displays ‘tablesoccer’

11. Write a program, similar to that in exercise 10, but modify it such that a dash (‘-‘) is inserted between the
words.
E.g.: if the user enters ‘thirty and ‘five, the program displays ‘thirty-five’


12. Write a program that:
· Prompts the user to enter two integer numbers (A and B)
· Displays the sum of the two numbers (A + B)
· Displays the product of the two numbers (A * B)
· Displays the quotient of the numbers (A / B)

13. Write a program that prompts the user to enter the length of the sides of a rectangle, and outputs the area
and the perimeter of the rectangle.........











Download Pascal programming language : exercises / PDF














Pascal programming language : exercises / PDF

0 commentaires: