Professional Documents
Culture Documents
Echo checking
Echo checking
Used to output statements at strategic locations in the program so that
intermediate values can be printed at each stage of the calculation or
logic.
C program Pascal program
/* Program DVT */ {PROGRAM DVT}
#include <stdio.h> PROGRAM DVT;
void main() VAR
{ Num1, Num2: integer;
int Num1, Num2; Begin
printf("Enter a number: "); write('Enter a number: ');
scanf("%d", &Num1); readln(Num1);
printf("%d and %d\n", Num1, Num2); writeln(Num1, ' and ', Num2);
Num2 = Num1 + 2; Num2 := Num1 + 2;
printf("%d and %d\n", Num1, Num2); writeln(Num1, ' and ', Num2);
Num1 = Num2 - 1; Num1 := Num2 - 1;
printf("%d and %d\n", Num1, Num2); writeln(Num1, ' and ', Num2);
Num2 = Num1 * 5; Num2 := Num1 * 5;
printf("%d and %d\n", Num1, Num2); writeln(Num1, ' and ', Num2);
Num2 = Num2 / 2; Num2 := Num2 DIV 2;
printf("%d and %d\n", Num1, Num2); writeln(Num1, ' and ', Num2);
printf("The results: "); write('The results: ');
printf("Num1 = %d and Num2 = %d writeln('Num1 = ', Num1, ' and Num2 = ',
\n", Num1, Num2); Num2)
} END.
More to Learn
Echo checking
The output of the above program with an input value of Num1 being
3 is listed as follows.
Enter a number:
3 and undefined
3 and 5
4 and 5
4 and 20
4 and 10
The results: Num1 = 4 and Num2 = 10
More to Learn
Echo checking
The output of the above program with an input value of Num1 being
3 is listed as follows.
Enter a number:
3 and undefined
3 and 5
4 and 5
4 and 20
4 and 10
The results: Num1 = 4 and Num2 = 10