Program add; {program to add 2 numbers and output the result} uses wincrt; begin write('Enter first...
-
Upload
robyn-henry -
Category
Documents
-
view
223 -
download
0
Transcript of Program add; {program to add 2 numbers and output the result} uses wincrt; begin write('Enter first...
program add;{program to add 2 numbers and output the result}uses wincrt;
beginwrite('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
program add;{program to add 2 numbers and output the result}uses wincrt;var
first_num : integer;second_num : integertotal : integer;
beginwrite('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
program add;program to add 2 numbers and output the result}uses wincrt;var
first_num : integer;second_num : integer;total : integer;
beginwrite('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
program add;{program to add 2 numbers and output the result}uses wincrt;var
first_num : integer;second_num : integer;total : integer;
beginwrite('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
program add;{program to add 2 numbers and output the result}uses wincrt;var
first_num : integer;second_num : integer;total : integer;
beginwrite(Enter first number: );readln(first_num);write('Enter second number: ');readln(second_num);total := first_num + second_num;write('Total: ',total);
end.
SPOT THE BUGNo quotes around text
program add;{program to add 2 numbers and output the result}uses wincrt;var
first_num : integer;second_num : integer;total : integer;
beginwrite('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
program add;{program to add 2 numbers and output the result}uses wincrt;var
first_num : integer;second_num : integer;total : integer;
beginwrite('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
program add;{program to add 2 numbers and output the result}uses wincrt;var
first_num : integer;second_num : integer;total : integer;
beginwrite('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
program add;{program to add 2 numbers and output the result}uses wincrt;var
first_num : integersecond_num : integertotal : integer
beginwrite('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;
program add;{program to add 2 numbers and output the result}uses wincrt;var
first_num : integer;secon_num : integer;total : integer;
beginwrite('Enter first number: ');readln(first_num);write('Enter second number: ');readln(second_num);total := first_num + second_num;write('Total: ',total);
end.
SPOT THE BUGVariable names inconsistent
program add;{program to add 2 numbers and output the result}uses wincrt;var
first_num : integer;second_num : integer;total : integer;
beginwrite('Enter first number: ');readl(first_num);write('Enter second number: ');readln(second_num);total := first_num + second_num;write('Total: ',total);
end.
SPOT THE BUGKeyword not correct
program add;{program to add 2 numbers and output the result}uses wincrt;var
first_num : integer;second_num : integer;total : integer;
startwrite('Enter first number: ');readln(first_num);write('Enter second number: ');readln(second_num);total := first_num + second_num;write('Total: ',total);
end.
SPOT THE BUGIncorrect keyword
program add{program to add 2 numbers and output the result}uses wincrt;var
first_num : integer;second_num : integer;total : integer;
beginwrite('Enter first number: ');readln(first_num);write('Enter second number: ');readln(second_num);total := firstnum + second_num;write('Total: ',total);
end.
SPOT THE BUG2 errors
program add;{program to add 2 numbers and output the result}uses wincrt;var
first_num : integer;second_num : integer;total : integer;
beginwrite('Enter first number: ')readln(first_num);write('Enter second number: ')readln(second_num);total := first_num + second_num;write('Total: ',total);
end.
SPOT THE BUG2 errors
program add;{program to add 2 numbers and output the result}uses wincrt;var
first_num : integer;second_num : integer;total : integer;
beginwrite('Enter first number: ');readln(first_num);write('Enter second number: ');readln(second_num);total = first_num / second_num;write('Total: ',total);
end.
SPOT THE BUG2 errors
program add;{program to add 2 numbers and output the result}uses wincrt;va
first_num : integer;second_num : integer;total : integer;
beginwrite('Enter first number: ');readln(first_num);write('Enter second number: ');readl(second_num);total := first_num + second_num;write('Total: ',total);
end.
SPOT THE BUG2 errors
That’s all folks!