Download presentation
Presentation is loading. Please wait.
Published byRobyn Henry Modified over 9 years ago
1
program add; {program to add 2 numbers and output the result} uses wincrt; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG No variable declarations
2
program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG ; No semi colon
3
program add; program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG { Missing curly bracket
4
program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(first_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG Incorrect variable used
5
program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write(Enter first number: ); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG No quotes around text
6
program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end SPOT THE BUG. Missing full stop
7
program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',first_num); end. SPOT THE BUG Incorrect variable used
8
program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ' total); end. SPOT THE BUG, Missing comma
9
program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer second_num : integer total : integer begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG ; ; Missing semi colons ;
10
program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; secon_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG Variable names inconsistent
11
program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readl(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG Keyword not correct
12
program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; start write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG Incorrect keyword
13
program add {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := firstnum + second_num; write('Total: ',total); end. SPOT THE BUG 2 errors
14
program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: ') readln(first_num); write('Enter second number: ') readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG 2 errors
15
program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total = first_num / second_num; write('Total: ',total); end. SPOT THE BUG 2 errors
16
program add; {program to add 2 numbers and output the result} uses wincrt; va first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readl(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG 2 errors
17
That’s all folks!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.