SlideShare a Scribd company logo
Introduction
     to
Programming
Computer Program
• A computer program is nothing more
than a list of instructions that tell the
computer what to do.
• A computer program is an organized
list of instructions that are designed to
cause the computer to behave in
predetermined manner in order to
accomplish a task.



                           Introduction to Programming
Computer Program
      Windows      OS      with     all    its
icons, toolbars, and menus is really
nothing more than a series of instructions
that the computer follows each time you
press a button, click on a menu, or
respond to a dialog box.
      At the base level, all programs
accept input from the user, process the
data, and display, save or print the results.


                             Introduction to Programming
Goals of a Program

• Be easily read and understood
• Be easy to correct if problems arise
• Be easy to modify as elements in
  the task may change
• Function as it was intended, to
  solve a specific problem or perform
  a specific task


                        Introduction to Programming
Programming
         Language
     A programming language is a
vocabulary and set of grammatical
rules for instructing a computer to
perform specific tasks.
     These grammatical rules are
also called the syntax of the
language.


                      Introduction to Programming
Programming
         Languages
1.   Machine languages
2.   Assembly languages
3.   High-level languages
4.   Fourth-generation languages




                      Introduction to Programming
Machine languages
  Machine languages use binary to
provide instructions to the computer.
  Machine languages are not
common today as they are specific to
each CPU and require long lists of
zeros and ones.
  These programs are very difficult to
write and very error-prone.

                        Introduction to Programming
Assembly languages
   Assembly languages use a special
representation of instructions to give
the computer instructions.
   These languages are only used by
programmers developing complicated
processes like operating systems.




                        Introduction to Programming
High-level languages
       High-level languages use English-
like commands to give instructions.
       They include
BASIC, Pascal, C, C+, C++, COBOL, Java,
 JavaScript and Fortran.
       Of course, the computer does not
speak English.
       It speaks binary, therefore the
programming instructions written in a high-
level language must be converted into
binary using a compiler or interpreter.


                           Introduction to Programming
Interpreters vs.
           Compilers
      Interpreters translate programs
one line at a time while compilers
convert a whole file or program at
once and then generate a separate
executable file.
      The executable file usually ends
with the extension .exe and can be
run without the programming
language.

                        Introduction to Programming
Fourth-generation
          languages
     Fourth-generation languages are
languages that write code for the user
through a series of menus and
prompts.
     Some examples of fourth
generation languages include
ORACLE, and Visual BASIC.



                        Introduction to Programming
Common Features of
Programming Languages

   There are many programming
languages that can be used to
create a computer program.
   Each of these languages has
different syntax.
   However, a basic set of
instructions is always present in
any programming language.

                      Introduction to Programming
Basic Set of Instructions

1. Input
2. Output
3. Mathematics
4. Conditional execution
5. Repetition




                     Introduction to Programming
BASIC Language

   BASIC stands for Beginner's All-
Purpose Symbolic Instruction Code.
   It is developed in the mid-1960s
at Dartmouth College by Professors
John G. Kemeny and Thomas E.
Kurtz.



                      Introduction to Programming
Why Study BASIC?
   When you learn BASIC, you also
learn many of the fundamentals of
other programming languages.
   You can also create programs
easily.
   Once you get into it, you'll find
that the fun in creating programs is
worth coming back to.

                     Introduction to Programming
QBASIC
   QBASIC is a programming
language written for computers back
in 1975, by Bill Gates and Paul Allen.




                        Introduction to Programming
Filename
                       Menu Bar




Immediate
 Window
WORK AREA
FORMAT IN WRITING
  PROGRAM LINES

LINE NO. PROGRAM STATEMENT


     10 CLS

     Space
10 CLS
500 END
10 CLS
20 DISPLAY 12
500 END
Errors in Programming
       If you made any mistakes you will be
given an error message.
       The error message, also called a
diagnostic message, will indicate the line
number and a description of the error.
       At this point, you will have to do what
is called debugging.
       Programmers spend a great deal of
time debugging programs.


                           Introduction to Programming
Debugging
      Debugging is the process of
finding and fixing errors in a program.
      The word debugging comes
from a common computer problem in
the 50's. Bugs would fly inside the
computer.
      Technicians had to find and
remove them in order for the system
to work.This word is still in use today.

                       Introduction to Programming
Types of Programming
          Errors
1. Syntax errors
2. Logic errors




                   Introduction to Programming
Syntax Error
    A syntax error is a mistake in the
grammar or structure of a command.
      For example, in QBASIC, the syntax
for PRINT says you must type PRINT, a
space, and then the literal, number or
expression.
      If by mistake you omit the command
PRINT, then the command will not work.
This is a syntax error.

                         Introduction to Programming
Syntax Error

     All syntax errors are captured by
the compiler or interpreter.
     When you get a syntax error in
your program, you should read and
decipher the error message, then
move to the line identified and fix the
error.


                       Introduction to Programming
Logic Error
       A logic error is much more difficult to isolate
and fix.
        A logic error is a mistake that the compiler
or interpreter cannot identify.
       This kind of error occurs when your
instructions have no syntax error, but the program
does not accomplish its intended purpose.
       For example, if you were asked to find the
area of a circle, but instead calculated the
circumference of a circle, then you would have a
logic error.

                               Introduction to Programming
Correcting Logic Error
       The only way to determine a logic
error is to test your program.
       You should check if the program
works correctly, figure out what the answer
should be (on your own), then check your
answer with the result the program
provides.
       If the computer provides a wrong
answer, then you will have to examine your
program to locate and fix the error.

                         Introduction to Programming
Save your program!
      Once you have found your error and
corrected it, rerun your program.
       When all errors are fixed, save the
file. To do this, press ALT + F (“File“) and
then press S("Save“). Your file will be
saved with the name you provide and will
end with the extension .bas.
       The maximum number of characters
for the QBASIC program filename is eight.

                           Introduction to Programming
10 CLS
20 DISPLAY 12
500 END
10 CLS
20 PRINT 12
500 END




  Change 12 by any number
10 CLS
20 PRINT LORA
500 END
Recall your Algebra!

Constants and Variables
Constants are represented by
    numerals.
Examples: 5, -3, 4.56, - 13.9
Variables are represented by letters.
Examples: x, y, n, C, F



                      Introduction to Programming
Recall MS Excel!
MS Excel Formula

In MS Excel, a cell can contain
    formula.
Example: Cell C1 contains =A1 * B1
A1 and B1 are cell addresses.
They can be used as variables in a
    formula.



                      Introduction to Programming
Variable Names

In Algebra, x + y means x is
     increased by y.
In Algebra, xy is the product of x and
     y.
In QBASIC, xy is only a single
     variable name and NOT a
     product of x and y.


                       Introduction to Programming
10 CLS
20 PRINT LORA
500 END
QBASIC COMMANDS
1. CLS – clears the screen
2. END – terminates the program
3. PRINT – displays the result of
   computer processing




                     Introduction to Programming

More Related Content

PPTX
Introduction to c programming
PPT
Computer programming concepts
PPT
Intro To Programming Concepts
PPTX
Basic Computer Programming
PPTX
Programming Language
PPTX
introduction to programming languages
PPT
Computer languages
PPTX
Introduction to programming languages
Introduction to c programming
Computer programming concepts
Intro To Programming Concepts
Basic Computer Programming
Programming Language
introduction to programming languages
Computer languages
Introduction to programming languages

What's hot (20)

PDF
Programming languages and concepts by vivek parihar
PPTX
Computer Programming Overview
PPTX
Programming Fundamental Slide No.1
PPT
Introduction Programming Languages
PPT
PPTX
Programming Paradigm & Languages
PPT
computer languages
PPTX
Coding vs programming
PPTX
Computer programming
PDF
History of C/C++ Language
PPTX
Programming languages
PPT
C programming presentation for university
PDF
Lesson 1 - Introduction to Programming .pdf
PPTX
Introduction to programming
PPTX
Natural language processing
PPTX
Beginning Python Programming
PPTX
Presentation on C programming language
PPTX
Types of Programming Languages
Programming languages and concepts by vivek parihar
Computer Programming Overview
Programming Fundamental Slide No.1
Introduction Programming Languages
Programming Paradigm & Languages
computer languages
Coding vs programming
Computer programming
History of C/C++ Language
Programming languages
C programming presentation for university
Lesson 1 - Introduction to Programming .pdf
Introduction to programming
Natural language processing
Beginning Python Programming
Presentation on C programming language
Types of Programming Languages
Ad

Viewers also liked (20)

PPT
Lect 1. introduction to programming languages
PPT
Introduction to-programming
PPS
Dacj 1-1 a
PPTX
Introduction to Programming Languages
PPT
Programming languages
PDF
Presentation of programming languages for beginners
PDF
Introduction of Programming language
PPS
Dacj 2-2 c
PPS
Oops recap
PPS
11 ds and algorithm session_16
PPS
Vb.net session 09
PPS
15 ooad uml-20
PPS
09 iec t1_s1_oo_ps_session_13
PDF
OOP Java
PPS
Rdbms xp 01
PPS
Jdbc session01
PPT
Tugas Pw [6]
PPTX
Add a web server
PPS
14 ooad uml-19
Lect 1. introduction to programming languages
Introduction to-programming
Dacj 1-1 a
Introduction to Programming Languages
Programming languages
Presentation of programming languages for beginners
Introduction of Programming language
Dacj 2-2 c
Oops recap
11 ds and algorithm session_16
Vb.net session 09
15 ooad uml-20
09 iec t1_s1_oo_ps_session_13
OOP Java
Rdbms xp 01
Jdbc session01
Tugas Pw [6]
Add a web server
14 ooad uml-19
Ad

Similar to Introduction to programming (20)

PPTX
Introduction to Programming kkkkkkkkkkkkk
PDF
Assignment on basic programming language
PDF
Form5 cd1
PDF
La5 ict-topic-5-programming
PPTX
grade 10 2023.pptx
PPTX
Introduction to Programming and QBasic Tutorial
PPTX
Programming _Language of Logic_ PPT.pptx
PPTX
Programming str_Language of Logic/c.pptx
PDF
10th class computer science notes in english by cstechz
DOC
Stnotes doc 5
DOCX
PROBLEM SOLVING
PPTX
Computer programming languages
PPTX
computerprogramminglanguages-201216152310.pptx
PPTX
Chapter 5
PPTX
Chapter 5-programming
PPT
Chapter 5( programming) answer
PDF
SULTHAN's - C Programming Language notes
DOC
What is a computer
DOC
Programming content
PPTX
computer programming computer programmin
Introduction to Programming kkkkkkkkkkkkk
Assignment on basic programming language
Form5 cd1
La5 ict-topic-5-programming
grade 10 2023.pptx
Introduction to Programming and QBasic Tutorial
Programming _Language of Logic_ PPT.pptx
Programming str_Language of Logic/c.pptx
10th class computer science notes in english by cstechz
Stnotes doc 5
PROBLEM SOLVING
Computer programming languages
computerprogramminglanguages-201216152310.pptx
Chapter 5
Chapter 5-programming
Chapter 5( programming) answer
SULTHAN's - C Programming Language notes
What is a computer
Programming content
computer programming computer programmin

Recently uploaded (20)

PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Cell Structure & Organelles in detailed.
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
RMMM.pdf make it easy to upload and study
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Cell Types and Its function , kingdom of life
PDF
Trump Administration's workforce development strategy
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
Classroom Observation Tools for Teachers
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Microbial diseases, their pathogenesis and prophylaxis
STATICS OF THE RIGID BODIES Hibbelers.pdf
Microbial disease of the cardiovascular and lymphatic systems
Final Presentation General Medicine 03-08-2024.pptx
Final Presentation General Medicine 03-08-2024.pptx
Cell Structure & Organelles in detailed.
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Module 4: Burden of Disease Tutorial Slides S2 2025
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
RMMM.pdf make it easy to upload and study
202450812 BayCHI UCSC-SV 20250812 v17.pptx
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Pharma ospi slides which help in ospi learning
Cell Types and Its function , kingdom of life
Trump Administration's workforce development strategy
A systematic review of self-coping strategies used by university students to ...
Classroom Observation Tools for Teachers
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Microbial diseases, their pathogenesis and prophylaxis

Introduction to programming

  • 1. Introduction to Programming
  • 2. Computer Program • A computer program is nothing more than a list of instructions that tell the computer what to do. • A computer program is an organized list of instructions that are designed to cause the computer to behave in predetermined manner in order to accomplish a task. Introduction to Programming
  • 3. Computer Program Windows OS with all its icons, toolbars, and menus is really nothing more than a series of instructions that the computer follows each time you press a button, click on a menu, or respond to a dialog box. At the base level, all programs accept input from the user, process the data, and display, save or print the results. Introduction to Programming
  • 4. Goals of a Program • Be easily read and understood • Be easy to correct if problems arise • Be easy to modify as elements in the task may change • Function as it was intended, to solve a specific problem or perform a specific task Introduction to Programming
  • 5. Programming Language A programming language is a vocabulary and set of grammatical rules for instructing a computer to perform specific tasks. These grammatical rules are also called the syntax of the language. Introduction to Programming
  • 6. Programming Languages 1. Machine languages 2. Assembly languages 3. High-level languages 4. Fourth-generation languages Introduction to Programming
  • 7. Machine languages Machine languages use binary to provide instructions to the computer. Machine languages are not common today as they are specific to each CPU and require long lists of zeros and ones. These programs are very difficult to write and very error-prone. Introduction to Programming
  • 8. Assembly languages Assembly languages use a special representation of instructions to give the computer instructions. These languages are only used by programmers developing complicated processes like operating systems. Introduction to Programming
  • 9. High-level languages High-level languages use English- like commands to give instructions. They include BASIC, Pascal, C, C+, C++, COBOL, Java, JavaScript and Fortran. Of course, the computer does not speak English. It speaks binary, therefore the programming instructions written in a high- level language must be converted into binary using a compiler or interpreter. Introduction to Programming
  • 10. Interpreters vs. Compilers Interpreters translate programs one line at a time while compilers convert a whole file or program at once and then generate a separate executable file. The executable file usually ends with the extension .exe and can be run without the programming language. Introduction to Programming
  • 11. Fourth-generation languages Fourth-generation languages are languages that write code for the user through a series of menus and prompts. Some examples of fourth generation languages include ORACLE, and Visual BASIC. Introduction to Programming
  • 12. Common Features of Programming Languages There are many programming languages that can be used to create a computer program. Each of these languages has different syntax. However, a basic set of instructions is always present in any programming language. Introduction to Programming
  • 13. Basic Set of Instructions 1. Input 2. Output 3. Mathematics 4. Conditional execution 5. Repetition Introduction to Programming
  • 14. BASIC Language BASIC stands for Beginner's All- Purpose Symbolic Instruction Code. It is developed in the mid-1960s at Dartmouth College by Professors John G. Kemeny and Thomas E. Kurtz. Introduction to Programming
  • 15. Why Study BASIC? When you learn BASIC, you also learn many of the fundamentals of other programming languages. You can also create programs easily. Once you get into it, you'll find that the fun in creating programs is worth coming back to. Introduction to Programming
  • 16. QBASIC QBASIC is a programming language written for computers back in 1975, by Bill Gates and Paul Allen. Introduction to Programming
  • 17. Filename Menu Bar Immediate Window
  • 19. FORMAT IN WRITING PROGRAM LINES LINE NO. PROGRAM STATEMENT 10 CLS Space
  • 21. 10 CLS 20 DISPLAY 12 500 END
  • 22. Errors in Programming If you made any mistakes you will be given an error message. The error message, also called a diagnostic message, will indicate the line number and a description of the error. At this point, you will have to do what is called debugging. Programmers spend a great deal of time debugging programs. Introduction to Programming
  • 23. Debugging Debugging is the process of finding and fixing errors in a program. The word debugging comes from a common computer problem in the 50's. Bugs would fly inside the computer. Technicians had to find and remove them in order for the system to work.This word is still in use today. Introduction to Programming
  • 24. Types of Programming Errors 1. Syntax errors 2. Logic errors Introduction to Programming
  • 25. Syntax Error A syntax error is a mistake in the grammar or structure of a command. For example, in QBASIC, the syntax for PRINT says you must type PRINT, a space, and then the literal, number or expression. If by mistake you omit the command PRINT, then the command will not work. This is a syntax error. Introduction to Programming
  • 26. Syntax Error All syntax errors are captured by the compiler or interpreter. When you get a syntax error in your program, you should read and decipher the error message, then move to the line identified and fix the error. Introduction to Programming
  • 27. Logic Error A logic error is much more difficult to isolate and fix. A logic error is a mistake that the compiler or interpreter cannot identify. This kind of error occurs when your instructions have no syntax error, but the program does not accomplish its intended purpose. For example, if you were asked to find the area of a circle, but instead calculated the circumference of a circle, then you would have a logic error. Introduction to Programming
  • 28. Correcting Logic Error The only way to determine a logic error is to test your program. You should check if the program works correctly, figure out what the answer should be (on your own), then check your answer with the result the program provides. If the computer provides a wrong answer, then you will have to examine your program to locate and fix the error. Introduction to Programming
  • 29. Save your program! Once you have found your error and corrected it, rerun your program. When all errors are fixed, save the file. To do this, press ALT + F (“File“) and then press S("Save“). Your file will be saved with the name you provide and will end with the extension .bas. The maximum number of characters for the QBASIC program filename is eight. Introduction to Programming
  • 30. 10 CLS 20 DISPLAY 12 500 END
  • 31. 10 CLS 20 PRINT 12 500 END Change 12 by any number
  • 32. 10 CLS 20 PRINT LORA 500 END
  • 33. Recall your Algebra! Constants and Variables Constants are represented by numerals. Examples: 5, -3, 4.56, - 13.9 Variables are represented by letters. Examples: x, y, n, C, F Introduction to Programming
  • 35. MS Excel Formula In MS Excel, a cell can contain formula. Example: Cell C1 contains =A1 * B1 A1 and B1 are cell addresses. They can be used as variables in a formula. Introduction to Programming
  • 36. Variable Names In Algebra, x + y means x is increased by y. In Algebra, xy is the product of x and y. In QBASIC, xy is only a single variable name and NOT a product of x and y. Introduction to Programming
  • 37. 10 CLS 20 PRINT LORA 500 END
  • 38. QBASIC COMMANDS 1. CLS – clears the screen 2. END – terminates the program 3. PRINT – displays the result of computer processing Introduction to Programming