INTERACTIVE TEST 3: Assignments, Read, Write.
| Notes | Tests | Home Page |
Previous Page


1. Write a Pascal statement which sums the two integer variables digit and value into the variable total

new integer total := digit + value;
value := digit + total;
digit := total - value;
total := digit + value;


2. Write a Pascal statement which subtracts the value 10 from the variable loop, leaving the result in the variable sum

sum := loop - 10;
loop = sum - 10;
sum = 10 - loop;
10 := loop - sum;


3. Write a Pascal statement to display the value of the integer variable total

writeln( "total" );
writeln( total );
writeln( 'total' );
write total;


4. Write a Pascal statement to read in a character value into the variable letter

read 'letter';
readln( "letter" );
read letter ;
readln( letter );


5. Write a Pascal statement to display the value of the real variable small_value using a field width of three places

write( "small_value:3" );
writeln( small_value:3 );
writeln( 'small_value:3' );
write small_value:3;


Previous Page
Copyright B Brown/P Henry, 1988-1999. All rights reserved.