- accept keyboard input of three integers (A,B,C);
- compute A+B-C;
- print (output) the computed result.
var
A, B, C, Compute: integer;
begin
Writeln ('Enter Number A: ');
Readln (A);
Writeln ('Enter Number B: ');
Readln (B);
Writeln ('Enter NUmber c: ');
Readln (C);
Compute := A + B - C;
Writeln ('The Result is = ', Compute:6);
Writeln('Press return to exit');
Readln;
end.
----------------------------------------------------------------------
2. Write an assembly language program that will:
- accept keyboard input of a positive integer value N;
- compute S= 1+ 2 + 3 + … + N;
- print (output) the computed result S.
var
N, S: integer;
begin
S := 0;
N := 0;
WHILE N >= 0 DO
begin
S := S + N;
Writeln ('The total is ', S);
Writeln ('Enter a positive number (negative to exit):');
Readln (N)
end;
end. {main}
-------------------------------------------------------------------------
3. Write an assembly language program that will:
- accept keyboard input of two integers;
- print (output)
- 1. if the first number is greater than the second number
- 2. if the second number is greater than the first number
var
Num1, Num2, Greatest: integer;
begin
Writeln ('Enter Two numbers: ');
Readln (Num1, Num2);
if Num1 > Num2 then
Greatest := 1
else Greatest := 2;
Writeln ('Greatest = ', Greatest:1);
Writeln('Press return to exit');
Readln;
end.
------------------------------------------------------------------------
If you find anything useful on this site, a thank you would be nice!!!
------------------------------------------------------------------------
Social: