Types of program errors
- System Error
- Syntax error
- Logic Error
- A System Error affects the computer hardware and it’s peripherals. For example you might write a program to print a handout, but there is no printer attached to the pc.. so the computer might stop responding.
- To eliminate such errors you must add small programs to check peripherals to your main program
- A Syntax error is most common in student’s programs and it is a typing mistake most generally. If you use commands improperly you get a system error too.
- Prnit “Hello”
- Syntax Errors cause the program to fail
- A logic error is a mistake in the program logic. For example you might program to clear the screen and then print hello using the following code. Obviously it does not work.
- A good way to eliminate Logical Errors is to use flowcharts.
- With a loop we can make the computer to do the same thing for how many times we want!
- Loops are very important and are used nearly in every program.
- Example of a loop:
- For times:= 2 to 10
- Print “Hello Buddy”
- Next times
- Another example of a loop:
- Print “This is a loop number” ; total
- Until total=12
Write a program that
Answer below :P
- Clear the screen
- Asks how many students are in class
- take their names
- Print out the names
Students = 0
Input “How many Students?” ; students
Print “You keyed in ”, students
For times = 1 to students
Input “Name of student ”, name$