It was designed by ibm in 1964 the main objective of

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: esigned in such a way that complete Pascal programs could be written without the use of any GO TO statement. Special control statements for selection and looping structures were provided for this purpose. To make programs structured, Pascal programs are composed of blocks. Each block of statements starts with a Begin statement and ends with an End statement. Due to the above mentioned features, Pascal is widely recognized as a language that encourages programmers to write well-structured, modular programs and instills good programming practices in a programmer. Owing to this reason, it is recognized as an educational language and is used to teach programming to beginners. Pascal was standardized by ANSI in 1983. Since then several dialects of Pascal have been made available on different computer systems. An object-oriented version of Pascal is also available. Pascal is suitable for both scientific and business applications because it has features to manipulate, not only numbers, but also vectors, matrices, strings of characters, sets, records, files and lists. A Pascal program to compute and print the sum of 10 numbers is given in Figure 12.21. The first line of the program contains the name of the program which is SUMNUMS. This is followed by two comment lines. Any comment can be placed within the symbols (* and *). Then, all the variables are declared. The variables SUM and N are declared as real and hence they can be assigned any real number. Similarly, the variable I, that has been declared to be an integer variable can be assigned any integer value. The heart of the program starts with the word BEGIN and ends with the word END. First, the variable SUM is initialized to zero. The next statement starts a DO loop that reads and computes the sum of the 10 numbers. Finally, the statement having WRITELN prints the result of the computation. PROGRAM SUMNUMS (INPUT, OUTPUT); (* PROGRAM TO COMPUTE THE SUM OF 10 NUMBERS *) (* DECLARATION OF VARIABLES *) VAR SUM, N : REAL; VAR I: INTEGER; (* MATN PROGRAM LOGI...
View Full Document

Ask a homework question - tutors are online