SlideShare a Scribd company logo
Unit – 2 Programming Concept
Introduction:
To interact with a person, we need to speak the language that he or
she can understand. Similarly, to interact with computer we need a
computer language that a computer can understand because
computer can understand only 0s and 1s. a computer language
provides a way of giving instructions to the computer.
What is a Program?
A program is a set of instructions written in a computer language
that directs the computer to perform a particular task and produce
the desired result. In order to perform the task, the program gives
these instructions to the computer.
1) Read Input
2) Process Data
3) Store Data
4) Write Output
However, before writing a program it is important to understand
the task and identify the various inputs required to produce the
output. For this the task is broken down into simple steps. This can
be accomplished by using three tools:
1) Algorithm
2) Flowchart
3) Pseudo code
Algorithm
An algorithm is the first step in developing a program. When we
tell the computer what to do, we also need to specify how it is
going to do it. For this, algorithms are required. An Algorithm can
be defined as a finite sequence of instructions for solving a
problem.
Example 1: Algorithm to go to School.
Step 1: Wake up early in the morning.
Step 2: Dress up for your school.
Step 3: Pack your school bag.
Step 4: Have your breakfast.
Step 5: Board your school bus.
Example 2: Algorithm to add two numbers.
Step 1: Take two numbers as inputs, say A and B.
Step 2: Add A and B and store the result in C.
Step 3: display the value of C.
Flowchart:
On the basis of Algorithm, we make Flowcharts. A Flowchart is a
pictorial representation of an algorithm. A flowchart makes it
easier to understand the logic of a program. In a flowchart,
different symbols are used for different instructions. The different
symbols and their descriptions are listed in the table.
Name Symbol Description
Start/ Stop Box Used to indicate the start and
the end of the flowchart.
Input/ Output Box Used to accept the input and
deliver the output.
Process Box Used for Processing.
Decision Box Used when the condition of
‘Yes’ or ‘No’ arises.
Flow Lines Used to show the flow of
control in the flowchart.
Guidelines for preparing Flowchart:
1) A flowchart should be neat, clear and easy to follow.
2) There should be only one start box and stop box.
3) Only one flow line should be used with the start or the
stop box.
4) Only one flow line should come out from a process box.
5) Only one flow line should enter the decision box.
Example 1: A flowchart to add two numbers.
Example 2: A flowchart to find greater number.
Example 3: A flowchart to go to school.
Loops:
Sometimes, you need to repeat a set of statements a number of
times. Instead of writing the statements again and again, you can
direct the flow lines back to a previous statement in the flowchart.
Such a sequence of statements which is repeated again and again is
said to be in a Loop.
Example: Check whether entered number is 55 or not?
Pseudo code:
A Pseudo Code is English– like representation of the program,
which is independent of any computer language. It is an outline or
a program that can be easily converted into program instructions in
a specific programming language. Pseudo code uses some
keywords to denote programming processes. These are some of
them-
1) Input: READ, OBTAIN, GET and PROMPT
2) Output: PRINT, DISPLAY and SHOW
3) Compute: COMPUTE, CALCULATE, DETERMINE,
ADD, SUBTRACT, MULTIPLY and DIVIDE
4) Initialize: SET and INITIALIZE
5) Add One: INCREMENT
Example 1: To add two numbers.
Step 1: READ number1 and number2.
Step 2: ADD number1and number2.
Step 3: PRINT total.
Example 2: To calculate the average marks of a student.
Step 1: READ total marks.
Step 2: DIVIDE total marks by the number of subjects.
Step 3: STORE the result in average.
Step 4: PRINT average.

More Related Content

What's hot

Pseudocode
PseudocodePseudocode
Pseudocode
Harsha Madushanka
 
C Programming Assignment
C Programming AssignmentC Programming Assignment
C Programming Assignment
Vijayananda Mohire
 
Looping statement in vb.net
Looping statement in vb.netLooping statement in vb.net
Looping statement in vb.netilakkiya
 
Error Detection and Correction - Data link Layer
Error Detection and Correction - Data link LayerError Detection and Correction - Data link Layer
Error Detection and Correction - Data link Layer
Abdullaziz Tagawy
 
Computer Fundamentals Chapter 11 pcp
Computer Fundamentals Chapter 11 pcpComputer Fundamentals Chapter 11 pcp
Computer Fundamentals Chapter 11 pcpSaumya Sahu
 
ICT EXAM.pdf
ICT EXAM.pdfICT EXAM.pdf
ICT EXAM.pdf
JomsVillanueva
 
evolution of operating system
evolution of operating systemevolution of operating system
evolution of operating system
Amir Khan
 
Web technology and e commerce ppt
Web technology and e  commerce pptWeb technology and e  commerce ppt
Web technology and e commerce ppt
Sadashiva Tandur
 
Introduction of internet
Introduction of internetIntroduction of internet
Introduction of internet
Gulbir Chaudhary
 
Ppt on visual basics
Ppt on visual basicsPpt on visual basics
Ppt on visual basics
younganand
 
Graphical programming
Graphical programmingGraphical programming
Graphical programming
Bilal Maqbool ツ
 
Plsql lab mannual
Plsql lab mannualPlsql lab mannual
Plsql lab mannual
Harish Khodke
 
C basics
C   basicsC   basics
GPA calculator and grading program in c++
GPA calculator and grading program in c++GPA calculator and grading program in c++
GPA calculator and grading program in c++
Taimur Muhammad
 
Accounting information systems the processes and controls turner 2nd edition ...
Accounting information systems the processes and controls turner 2nd edition ...Accounting information systems the processes and controls turner 2nd edition ...
Accounting information systems the processes and controls turner 2nd edition ...abb183n
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
tanmaymodi4
 
Recursive Function
Recursive FunctionRecursive Function
Recursive Function
Kamal Acharya
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
Hemant Sharma
 

What's hot (20)

Pseudocode
PseudocodePseudocode
Pseudocode
 
C Programming Assignment
C Programming AssignmentC Programming Assignment
C Programming Assignment
 
Looping statement in vb.net
Looping statement in vb.netLooping statement in vb.net
Looping statement in vb.net
 
Error Detection and Correction - Data link Layer
Error Detection and Correction - Data link LayerError Detection and Correction - Data link Layer
Error Detection and Correction - Data link Layer
 
Computer Fundamentals Chapter 11 pcp
Computer Fundamentals Chapter 11 pcpComputer Fundamentals Chapter 11 pcp
Computer Fundamentals Chapter 11 pcp
 
Excel assignment
Excel assignmentExcel assignment
Excel assignment
 
ICT EXAM.pdf
ICT EXAM.pdfICT EXAM.pdf
ICT EXAM.pdf
 
evolution of operating system
evolution of operating systemevolution of operating system
evolution of operating system
 
Web technology and e commerce ppt
Web technology and e  commerce pptWeb technology and e  commerce ppt
Web technology and e commerce ppt
 
Introduction of internet
Introduction of internetIntroduction of internet
Introduction of internet
 
Ppt on visual basics
Ppt on visual basicsPpt on visual basics
Ppt on visual basics
 
Graphical programming
Graphical programmingGraphical programming
Graphical programming
 
Structure
StructureStructure
Structure
 
Plsql lab mannual
Plsql lab mannualPlsql lab mannual
Plsql lab mannual
 
C basics
C   basicsC   basics
C basics
 
GPA calculator and grading program in c++
GPA calculator and grading program in c++GPA calculator and grading program in c++
GPA calculator and grading program in c++
 
Accounting information systems the processes and controls turner 2nd edition ...
Accounting information systems the processes and controls turner 2nd edition ...Accounting information systems the processes and controls turner 2nd edition ...
Accounting information systems the processes and controls turner 2nd edition ...
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
 
Recursive Function
Recursive FunctionRecursive Function
Recursive Function
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
 

Similar to programming concept

Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
rajkumar1631010038
 
Problem solving methodology
Problem solving methodologyProblem solving methodology
Problem solving methodology
Prof. Dr. K. Adisesha
 
265 ge8151 problem solving and python programming - 2 marks with answers
265   ge8151 problem solving and python programming - 2 marks with answers265   ge8151 problem solving and python programming - 2 marks with answers
265 ge8151 problem solving and python programming - 2 marks with answers
vithyanila
 
3 algorithm-and-flowchart
3 algorithm-and-flowchart3 algorithm-and-flowchart
3 algorithm-and-flowchart
Rohit Shrivastava
 
Algorithm defination, design & Implementation
Algorithm defination, design & ImplementationAlgorithm defination, design & Implementation
Algorithm defination, design & Implementation
Bilal Maqbool ツ
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)
praveena p
 
Module 1 python.pptx
Module 1 python.pptxModule 1 python.pptx
Module 1 python.pptx
AnuragJoshi813963
 
GE3151 PSPP _Unit 1 notes and Question bank.pdf
GE3151 PSPP _Unit 1 notes and Question bank.pdfGE3151 PSPP _Unit 1 notes and Question bank.pdf
GE3151 PSPP _Unit 1 notes and Question bank.pdf
Asst.prof M.Gokilavani
 
Chapter 2(1)
Chapter 2(1)Chapter 2(1)
Chapter 2(1)
TejaswiB4
 
Programing Fundamental
Programing FundamentalPrograming Fundamental
Programing Fundamental
Qazi Shahzad Ali
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
Sachin Goyani
 
Algorithms notes 2 tutorials duniya
Algorithms notes 2   tutorials duniyaAlgorithms notes 2   tutorials duniya
Algorithms notes 2 tutorials duniya
TutorialsDuniya.com
 
L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdf
MMRF2
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
ShaswatSurya
 
Algorithm for computational problematic sit
Algorithm for computational problematic sitAlgorithm for computational problematic sit
Algorithm for computational problematic sit
Saurabh846965
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
umardanjumamaiwada
 
lecture 5
 lecture 5 lecture 5
lecture 5
umardanjumamaiwada
 
c_programming.pdf
c_programming.pdfc_programming.pdf
c_programming.pdf
Home
 
Lecture_01-Problem_Solving[1]||ProgrammingFundamental.ppt
Lecture_01-Problem_Solving[1]||ProgrammingFundamental.pptLecture_01-Problem_Solving[1]||ProgrammingFundamental.ppt
Lecture_01-Problem_Solving[1]||ProgrammingFundamental.ppt
cosc242101003
 
Fundamental of Information Technology - UNIT 6
Fundamental of Information Technology - UNIT 6Fundamental of Information Technology - UNIT 6
Fundamental of Information Technology - UNIT 6
Shipra Swati
 

Similar to programming concept (20)

Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
 
Problem solving methodology
Problem solving methodologyProblem solving methodology
Problem solving methodology
 
265 ge8151 problem solving and python programming - 2 marks with answers
265   ge8151 problem solving and python programming - 2 marks with answers265   ge8151 problem solving and python programming - 2 marks with answers
265 ge8151 problem solving and python programming - 2 marks with answers
 
3 algorithm-and-flowchart
3 algorithm-and-flowchart3 algorithm-and-flowchart
3 algorithm-and-flowchart
 
Algorithm defination, design & Implementation
Algorithm defination, design & ImplementationAlgorithm defination, design & Implementation
Algorithm defination, design & Implementation
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)
 
Module 1 python.pptx
Module 1 python.pptxModule 1 python.pptx
Module 1 python.pptx
 
GE3151 PSPP _Unit 1 notes and Question bank.pdf
GE3151 PSPP _Unit 1 notes and Question bank.pdfGE3151 PSPP _Unit 1 notes and Question bank.pdf
GE3151 PSPP _Unit 1 notes and Question bank.pdf
 
Chapter 2(1)
Chapter 2(1)Chapter 2(1)
Chapter 2(1)
 
Programing Fundamental
Programing FundamentalPrograming Fundamental
Programing Fundamental
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
Algorithms notes 2 tutorials duniya
Algorithms notes 2   tutorials duniyaAlgorithms notes 2   tutorials duniya
Algorithms notes 2 tutorials duniya
 
L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdf
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
Algorithm for computational problematic sit
Algorithm for computational problematic sitAlgorithm for computational problematic sit
Algorithm for computational problematic sit
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
 
lecture 5
 lecture 5 lecture 5
lecture 5
 
c_programming.pdf
c_programming.pdfc_programming.pdf
c_programming.pdf
 
Lecture_01-Problem_Solving[1]||ProgrammingFundamental.ppt
Lecture_01-Problem_Solving[1]||ProgrammingFundamental.pptLecture_01-Problem_Solving[1]||ProgrammingFundamental.ppt
Lecture_01-Problem_Solving[1]||ProgrammingFundamental.ppt
 
Fundamental of Information Technology - UNIT 6
Fundamental of Information Technology - UNIT 6Fundamental of Information Technology - UNIT 6
Fundamental of Information Technology - UNIT 6
 

Recently uploaded

Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 

Recently uploaded (20)

Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 

programming concept

  • 1. Unit – 2 Programming Concept Introduction: To interact with a person, we need to speak the language that he or she can understand. Similarly, to interact with computer we need a computer language that a computer can understand because computer can understand only 0s and 1s. a computer language provides a way of giving instructions to the computer. What is a Program? A program is a set of instructions written in a computer language that directs the computer to perform a particular task and produce the desired result. In order to perform the task, the program gives these instructions to the computer. 1) Read Input 2) Process Data 3) Store Data 4) Write Output However, before writing a program it is important to understand the task and identify the various inputs required to produce the output. For this the task is broken down into simple steps. This can be accomplished by using three tools: 1) Algorithm 2) Flowchart 3) Pseudo code
  • 2. Algorithm An algorithm is the first step in developing a program. When we tell the computer what to do, we also need to specify how it is going to do it. For this, algorithms are required. An Algorithm can be defined as a finite sequence of instructions for solving a problem. Example 1: Algorithm to go to School. Step 1: Wake up early in the morning. Step 2: Dress up for your school. Step 3: Pack your school bag. Step 4: Have your breakfast. Step 5: Board your school bus. Example 2: Algorithm to add two numbers. Step 1: Take two numbers as inputs, say A and B. Step 2: Add A and B and store the result in C. Step 3: display the value of C. Flowchart: On the basis of Algorithm, we make Flowcharts. A Flowchart is a pictorial representation of an algorithm. A flowchart makes it easier to understand the logic of a program. In a flowchart, different symbols are used for different instructions. The different symbols and their descriptions are listed in the table. Name Symbol Description Start/ Stop Box Used to indicate the start and the end of the flowchart.
  • 3. Input/ Output Box Used to accept the input and deliver the output. Process Box Used for Processing. Decision Box Used when the condition of ‘Yes’ or ‘No’ arises. Flow Lines Used to show the flow of control in the flowchart. Guidelines for preparing Flowchart: 1) A flowchart should be neat, clear and easy to follow. 2) There should be only one start box and stop box. 3) Only one flow line should be used with the start or the stop box. 4) Only one flow line should come out from a process box. 5) Only one flow line should enter the decision box. Example 1: A flowchart to add two numbers.
  • 4. Example 2: A flowchart to find greater number. Example 3: A flowchart to go to school.
  • 5. Loops: Sometimes, you need to repeat a set of statements a number of times. Instead of writing the statements again and again, you can direct the flow lines back to a previous statement in the flowchart. Such a sequence of statements which is repeated again and again is said to be in a Loop. Example: Check whether entered number is 55 or not?
  • 6. Pseudo code: A Pseudo Code is English– like representation of the program, which is independent of any computer language. It is an outline or a program that can be easily converted into program instructions in a specific programming language. Pseudo code uses some keywords to denote programming processes. These are some of them- 1) Input: READ, OBTAIN, GET and PROMPT 2) Output: PRINT, DISPLAY and SHOW 3) Compute: COMPUTE, CALCULATE, DETERMINE, ADD, SUBTRACT, MULTIPLY and DIVIDE 4) Initialize: SET and INITIALIZE 5) Add One: INCREMENT Example 1: To add two numbers. Step 1: READ number1 and number2. Step 2: ADD number1and number2. Step 3: PRINT total. Example 2: To calculate the average marks of a student. Step 1: READ total marks. Step 2: DIVIDE total marks by the number of subjects. Step 3: STORE the result in average. Step 4: PRINT average.