ๅฐŠๆ•ฌ็š„ ๅพฎไฟกๆฑ‡็Ž‡๏ผš1ๅ†† โ‰ˆ 0.046166 ๅ…ƒ ๆ”ฏไป˜ๅฎๆฑ‡็Ž‡๏ผš1ๅ†† โ‰ˆ 0.046257ๅ…ƒ [้€€ๅ‡บ็™ปๅฝ•]
SlideShare a Scribd company logo
PROBLEM SOLVING
Programming
To solve a computing problem, its solution must be specified in terms of sequence of
computational steps such that they are effectively solved by a human agent or by a digital
computer.
Programming Language
1) The specification of the sequence of computational steps in a particular
programming language is termedas a program
2) The task of developing programs is calledprogramming
3) The personengaged in programming activity is calledprogrammer
Techniques of Problem Solving
Problem solving an art in that it requires enormous intuitive power & a science for it
takes a pragmatic approach.
Here a rough outline of a general problem solving approach.
1) Write out the problem statement include information on what you are to solve &
consider why you needto solve the problem
2) Make sure you are solving the real problem as opposed to the perceived problem. To
checkto see that you define & solve the real problem
3) Draw & label a sketch. Define & name all variables and /or symbols. Show numerical
values of variables, if known.
4) Identify & Name
a. relevant principles, theories& equations
b. system & subsystems
c. dependent & independent variables
d. known & unknowns
e. inputs & outputs
f. necessaryinformation
5) List assumptions and approximations involved in solving the problem. Question the
assumptions and then state which ones are the most reasonable for your purposes.
6) Check to see if the problem is either under-specified, figure out how to find the
missing information. If over-specified, identify the extra information that is not
needed.
7) Relate problem to similar problem or experience
8) Use an algorithm
9) Evaluate and examine and evaluate the answer to see it makes sense.
Introductionto C Programming
C is a general-purpose computer programming language developed in 1972 by Dennis
Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. C is a
structured programming language, which means that it allows you to develop programs using
well-defined control structures (you will learn about control structures in the articles to
come), and provides modularity (breaking the task into multiple sub tasks that are simple
enough to understand and to reuse).C is often called a middle-level language because it
combines the best elements of low-level or machine language with high-level languages.
Where is C useful?
Cโ€™s ability to communicate directly with hardware makes it a powerful choice for system
programmers. In fact, popular operating systems such as Unix and Linux are written entirely
in C. Additionally, even compilers and interpreters for other languages such as FORTRAN,
Pascal, and BASIC are written in C. However, Cโ€™s scope is not just limited to developing
system programs. It is also used to develop any kind of application, including complex
business ones. The followingis a partial list of areas where C language is used:
- Embedded Systems
- Systems Programming
- Artificial Intelligence
- Industrial Automation
- Computer Graphics
- Space Research
Why you shouldlearnC?
You should learnC because:
ยท C is simple.
ยท There are only 32 keywords so C is very easy to master. Keywords are words that have
special meaning in C language.
ยท C programs run faster than programs written in most other languages.
ยท C enables easy communication with computer hardware making it easy to write system
programs such as compilers andinterpreters.
WHY WE NEED DATA AND A PROGRAM
Any computer program has two entities to consider, the data, and the program. They are
highly dependent on one another and careful planning of both will lead to a well planned and
well written program. Unfortunately, it is not possible to study either completely without a
good working knowledge of the other. For that reason, this tutorial will jump back and forth
between teaching methods of program writing and methods of data definition. Simply follow
along and you will have a good understanding of both. Keep in mind that, even though it
seems expedient to sometimes jump right into coding the program, time spent planning the
data structures will be well spent and the quality of the final program will reflect the original
planning
How to run a simple c program
1. Copy Turbo c/c++ incomputer
2. Open c:tcbintc.axe
3. A window appears
4. Select File->newto opena new file
5. Type the followingprogram on editor
#include
void main()
{
print f(โ€œhelloโ€);
}
6. compile the program by pressingALT+F9
7. Run the program by pressingCTRL +F9
Note:
1. C is case sensitive
2. Always terminate statementswithsemicolon.
3. A program starts with main()
Explanationofprogram
#include is known as compiler directive. A compiler directive is a command to compiler to
translate the program in a certain way. These statement are not converted into machine
language but only perform some othertask.
main() is a function which the staring point for compiler to start compilation. So a function
must containa main() function.
DETECTION AND CORRECTION OF ERRORS
Syntactic errors and execution errors usually result in the generation of error messages when
compiling or executing a program. Error of this type is usually quite easy to find and correct.
There are some logical errors that can be very difficult to detect. Since the output resulting
from a logically incorrect program may appear to be error free. Logical errors are often hard
to find, so in order to find and correct errors of this type is known as logical debugging. To
detect errors test a new program with data that will give a known answer. If the correct
results are not obtained then the program obviously contains errors even if the correct results
are obtained.
Computer Applications: However you cannot be sure that the program is error free, since
some errors cause incorrect result only under certain circumstances. Therefore a new
program should receive thorough testing before it is considered to be debugged. Once it has
been established that a program contains a logical error, some ingenuity may be required to
find the error. Error detection should always begin with a thorough review of each logical
group of statements within the program. If the error cannot be found, it sometimes helps to
set the program aside for a while. If an error cannot be located simply by inspection, the
program should be modified to print out certain intermediate results and then be rerun. This
technique is referred to as tracing. The source of error will often become evident once these
intermediate calculations have been carefully examined. The greater the amount of
intermediate output, the more likely the chances of pointing the source of errors. Sometimes
an error simply cannot be located. Some C compilers include a debugger, which is a special
program that facilitates the detection of errors in C programs. In particular a debugger allows
the execution of a source program to be suspended at designated places, called break points,
revealing the values assigned to the program variables and array elements at the time
execution stops. Some debuggers also allow a program to execute continuously until some
specified error condition has occurred. By examining the values assigned to the variables at
the break points, it is easier to determine whenand where an error originates.
Linear Programming
Linear program is a method for straightforward programming in a sequential manner. This
type of programming does not involve any decision making. General model of these linear
programs is:
1. Read a data value
2. Computer an intermediate result
3. Use the intermediate result to computer the desiredanswer
4. Print the answer
5. Stop
StructuredProgramming
Structured programming (sometimes known as modular programming) is a subset of procedural
programming that enforces a logical structure on the program being written to make it more
efficient and easier to understand and modify. Certain languages such as Ada, Pascal, and BASE
are designed with features that encourage or enforce a logical program structure.
Structured programming frequently employs a top-down design model, in which developers map
out the overall program structure into separate subsections. A defined function or set of similar
functions is coded in a separate module or sub module, which means that code can be loaded into
memory more efficiently and that modules can be reused in other programs. After a module has
been tested individually, it is then integrated with other modules into the overall program
structure.
Advantages of StructuredProgramming
1. Easy to write:
Modular design increases the programmer's productivity by allowing them to look at
the big picture first and focus on details later.Several Programmers can work on a
single, large program, each working on a different module. Studies show structured
programs take less time to write than standard programs. Procedures written for one
program can be reused in other programs requiring the same task. A procedure that
can be used in many programs is said to be reusable.
2. Easy to debug:
Since each procedure is specialized to perform just one task, a procedure can be
checked individually. Older unstructured programs consist of a sequence of
instructions that are not grouped for specific tasks. The logic of such programs is
clutteredwithdetails and therefore difficultto follow.
3. Easy to Understand:
The relationship between the procedures shows the modular design of the program.
Meaningful procedure names and clear documentation identify the task performed by
each module. Meaningful variable names help the programmer identify the purpose of
each variable.
4. Easy to Change:
Since a correctly written structured program is self-documenting, it can be easily
understoodby another programmer.
StructuredProgramming Constructs
It uses only three constructs -
ยท Sequence (statements, blocks)
ยท Selection(if, switch)
ยท Iteration(loops like while and for)
Sequence
ยท Any valid expressionterminatedbya semicolonis a statement.
ยท Statements may be grouped together by surrounding them with a pair of curlybraces.
ยท Such a group is syntactically equivalent to one statement and can be inserted where
ever
ยท One statement is legal.
Selection
The selection constructs allow us to follow different paths in different situations. We
may also think of them as enabling us to express decisions.
The main selectionconstructis:
if (expression)
statement1
else
statement2
statement1 is executed if and only if expression evaluates to some non-zero number. If
expression evaluates to 0, statement1 is not executed. Inthat case, statement2 is executed.
If and else are independent constructs, in that if can occur without else (but not the
reverse)Any else is paired with the most recent else-less if, unless curly braces enforce a
different scheme. Note that only curly braces, not parentheses, must be used to enforce the
pairing. Parentheses
Iteration
Looping is a way by which we can execute any some set of statements more than one times
continuously.In C there are mainly three types of loops are used :
ยท while Loop
ยท do while Loop
ยท For Loop
The control structuresare easyto use because of the followingreasons:
1) They are easyto recognize
2) They are simple to deal with as they have just one entry and one exit point
3) They are free of the complications of anyparticular programming language

More Related Content

What's hot

Chapter 5( programming) answer
Chapter 5( programming) answerChapter 5( programming) answer
Chapter 5( programming) answer
smkengkilili2011
ย 
Module 201 2 20 just 20 basic
Module 201   2  20  just 20 basic Module 201   2  20  just 20 basic
Module 201 2 20 just 20 basic
Nick Racers
ย 
Form5 cd1
Form5 cd1Form5 cd1
Form5 cd1
smktsj2
ย 
Computer
ComputerComputer
Notacd07
Notacd07Notacd07
Notacd07
Azmiah Mahmud
ย 
La5 programming
La5  programmingLa5  programming
La5 programming
smkengkilili2011
ย 
La5 ict-topic-5-programming
La5 ict-topic-5-programmingLa5 ict-topic-5-programming
La5 ict-topic-5-programming
Kak Yong
ย 
The Programming Process
The Programming ProcessThe Programming Process
The Programming Process
Casey Robertson
ย 
Ict - Programming
Ict - ProgrammingIct - Programming
Ict - Programming
aleeya91
ย 
An introduction to programming
An introduction to programmingAn introduction to programming
An introduction to programming
rprajat007
ย 
Computer
ComputerComputer
Computer
leeparkkim
ย 
Program design and problem solving techniques
Program design and problem solving techniquesProgram design and problem solving techniques
Program design and problem solving techniques
Dokka Srinivasu
ย 
The Programmer Life Cycle
The Programmer Life CycleThe Programmer Life Cycle
The Programmer Life Cycle
Russell Ovans
ย 
ML Tutorial Introduction
ML Tutorial IntroductionML Tutorial Introduction
ML Tutorial Introduction
elbop
ย 
Chapter 5-programming
Chapter 5-programmingChapter 5-programming
Chapter 5-programming
Aten Kecik
ย 
SYSTEM DEVELOPMENT
SYSTEM DEVELOPMENTSYSTEM DEVELOPMENT
SYSTEM DEVELOPMENT
shahzadebaujiti
ย 
Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2
Mohd Harris Ahmad Jaal
ย 
Nota program development
Nota program developmentNota program development
Nota program development
Azmiah Mahmud
ย 
Abc c program
Abc c programAbc c program
Abc c program
Dayakar Siddula
ย 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
Prof. Erwin Globio
ย 

What's hot (20)

Chapter 5( programming) answer
Chapter 5( programming) answerChapter 5( programming) answer
Chapter 5( programming) answer
ย 
Module 201 2 20 just 20 basic
Module 201   2  20  just 20 basic Module 201   2  20  just 20 basic
Module 201 2 20 just 20 basic
ย 
Form5 cd1
Form5 cd1Form5 cd1
Form5 cd1
ย 
Computer
ComputerComputer
Computer
ย 
Notacd07
Notacd07Notacd07
Notacd07
ย 
La5 programming
La5  programmingLa5  programming
La5 programming
ย 
La5 ict-topic-5-programming
La5 ict-topic-5-programmingLa5 ict-topic-5-programming
La5 ict-topic-5-programming
ย 
The Programming Process
The Programming ProcessThe Programming Process
The Programming Process
ย 
Ict - Programming
Ict - ProgrammingIct - Programming
Ict - Programming
ย 
An introduction to programming
An introduction to programmingAn introduction to programming
An introduction to programming
ย 
Computer
ComputerComputer
Computer
ย 
Program design and problem solving techniques
Program design and problem solving techniquesProgram design and problem solving techniques
Program design and problem solving techniques
ย 
The Programmer Life Cycle
The Programmer Life CycleThe Programmer Life Cycle
The Programmer Life Cycle
ย 
ML Tutorial Introduction
ML Tutorial IntroductionML Tutorial Introduction
ML Tutorial Introduction
ย 
Chapter 5-programming
Chapter 5-programmingChapter 5-programming
Chapter 5-programming
ย 
SYSTEM DEVELOPMENT
SYSTEM DEVELOPMENTSYSTEM DEVELOPMENT
SYSTEM DEVELOPMENT
ย 
Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2
ย 
Nota program development
Nota program developmentNota program development
Nota program development
ย 
Abc c program
Abc c programAbc c program
Abc c program
ย 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
ย 

Similar to PROBLEM SOLVING

SULTHAN's - C Programming Language notes
SULTHAN's - C Programming Language notesSULTHAN's - C Programming Language notes
SULTHAN's - C Programming Language notes
SULTHAN BASHA
ย 
Overview of c++
Overview of c++Overview of c++
Overview of c++
geeeeeet
ย 
Chapter 2(1)
Chapter 2(1)Chapter 2(1)
Chapter 2(1)
TejaswiB4
ย 
Required computer skills program devlopment
Required computer skills program devlopmentRequired computer skills program devlopment
Required computer skills program devlopment
Hubert Shanthan
ย 
Comso c++
Comso c++Comso c++
Comso c++
Mi L
ย 
Programming vs Coding: Unveiling The Key Differences
Programming vs Coding: Unveiling The Key DifferencesProgramming vs Coding: Unveiling The Key Differences
Programming vs Coding: Unveiling The Key Differences
FredReynolds2
ย 
grade 10 2023.pptx
grade 10 2023.pptxgrade 10 2023.pptx
grade 10 2023.pptx
RaymartHerera
ย 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptx
DivyaKS12
ย 
Introduction to problem solving in C
Introduction to problem solving in CIntroduction to problem solving in C
Introduction to problem solving in C
Diwakar Pratap Singh 'Deva'
ย 
computer Unit 6
computer Unit 6computer Unit 6
computer Unit 6
Aqeel Rehman
ย 
Programming
ProgrammingProgramming
Programming
vanesa4ab
ย 
Python_Module_1.pdf
Python_Module_1.pdfPython_Module_1.pdf
Python_Module_1.pdf
R.K.College of engg & Tech
ย 
main
mainmain
main
Rafsun Rafat
ย 
Sepm t1
Sepm t1Sepm t1
Sepm t1
sapariyapiyushluck
ย 
Algorithm to programs.pptx
Algorithm to programs.pptxAlgorithm to programs.pptx
Algorithm to programs.pptx
Chandansharma918351
ย 
C tutorials
C tutorialsC tutorials
C tutorials
sujit11feb
ย 
Computer Programming
Computer Programming Computer Programming
Computer Programming
Newreborn Incarnation
ย 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++
Seble Nigussie
ย 
Module 1 2 just basic-
Module 1 2  just basic-Module 1 2  just basic-
Module 1 2 just basic-
Shanmugam Thiagoo
ย 
[ITP - Lecture 02] Steps to Create Program & Approaches of Programming
[ITP - Lecture 02] Steps to Create Program & Approaches of Programming[ITP - Lecture 02] Steps to Create Program & Approaches of Programming
[ITP - Lecture 02] Steps to Create Program & Approaches of Programming
Muhammad Hammad Waseem
ย 

Similar to PROBLEM SOLVING (20)

SULTHAN's - C Programming Language notes
SULTHAN's - C Programming Language notesSULTHAN's - C Programming Language notes
SULTHAN's - C Programming Language notes
ย 
Overview of c++
Overview of c++Overview of c++
Overview of c++
ย 
Chapter 2(1)
Chapter 2(1)Chapter 2(1)
Chapter 2(1)
ย 
Required computer skills program devlopment
Required computer skills program devlopmentRequired computer skills program devlopment
Required computer skills program devlopment
ย 
Comso c++
Comso c++Comso c++
Comso c++
ย 
Programming vs Coding: Unveiling The Key Differences
Programming vs Coding: Unveiling The Key DifferencesProgramming vs Coding: Unveiling The Key Differences
Programming vs Coding: Unveiling The Key Differences
ย 
grade 10 2023.pptx
grade 10 2023.pptxgrade 10 2023.pptx
grade 10 2023.pptx
ย 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptx
ย 
Introduction to problem solving in C
Introduction to problem solving in CIntroduction to problem solving in C
Introduction to problem solving in C
ย 
computer Unit 6
computer Unit 6computer Unit 6
computer Unit 6
ย 
Programming
ProgrammingProgramming
Programming
ย 
Python_Module_1.pdf
Python_Module_1.pdfPython_Module_1.pdf
Python_Module_1.pdf
ย 
main
mainmain
main
ย 
Sepm t1
Sepm t1Sepm t1
Sepm t1
ย 
Algorithm to programs.pptx
Algorithm to programs.pptxAlgorithm to programs.pptx
Algorithm to programs.pptx
ย 
C tutorials
C tutorialsC tutorials
C tutorials
ย 
Computer Programming
Computer Programming Computer Programming
Computer Programming
ย 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++
ย 
Module 1 2 just basic-
Module 1 2  just basic-Module 1 2  just basic-
Module 1 2 just basic-
ย 
[ITP - Lecture 02] Steps to Create Program & Approaches of Programming
[ITP - Lecture 02] Steps to Create Program & Approaches of Programming[ITP - Lecture 02] Steps to Create Program & Approaches of Programming
[ITP - Lecture 02] Steps to Create Program & Approaches of Programming
ย 

More from shahzadebaujiti

IMPERIALISM AND TERRITORIAL DIVISION OF THE WORLD (COLONIZATION OF AFRICA)
IMPERIALISM AND TERRITORIAL DIVISION OF THE WORLD (COLONIZATION OF AFRICA)IMPERIALISM AND TERRITORIAL DIVISION OF THE WORLD (COLONIZATION OF AFRICA)
IMPERIALISM AND TERRITORIAL DIVISION OF THE WORLD (COLONIZATION OF AFRICA)
shahzadebaujiti
ย 
THE RISE OF DEMOCRACY IN EUROPE
THE RISE OF DEMOCRACY IN EUROPE THE RISE OF DEMOCRACY IN EUROPE
THE RISE OF DEMOCRACY IN EUROPE
shahzadebaujiti
ย 
THE RISE OF CAPITALISM IN EUROPE
THE RISE OF CAPITALISM IN EUROPETHE RISE OF CAPITALISM IN EUROPE
THE RISE OF CAPITALISM IN EUROPE
shahzadebaujiti
ย 
CLIMATOLOGY CLIMATOLOGY
CLIMATOLOGY CLIMATOLOGYCLIMATOLOGY CLIMATOLOGY
CLIMATOLOGY CLIMATOLOGY
shahzadebaujiti
ย 
SUSTAINABLE USE OF FUEL AND POWER
SUSTAINABLE USE OF FUEL AND POWERSUSTAINABLE USE OF FUEL AND POWER
SUSTAINABLE USE OF FUEL AND POWER
shahzadebaujiti
ย 
SPACE DYNAMIC
SPACE DYNAMICSPACE DYNAMIC
SPACE DYNAMIC
shahzadebaujiti
ย 
PHYSICAL GEOGRAPHY 1.5 -STUDY OF SOIL
PHYSICAL GEOGRAPHY 1.5 -STUDY OF SOILPHYSICAL GEOGRAPHY 1.5 -STUDY OF SOIL
PHYSICAL GEOGRAPHY 1.5 -STUDY OF SOIL
shahzadebaujiti
ย 
PHYSICAL GEOGRAPHY 1.4-WATER MASSES
PHYSICAL GEOGRAPHY 1.4-WATER MASSESPHYSICAL GEOGRAPHY 1.4-WATER MASSES
PHYSICAL GEOGRAPHY 1.4-WATER MASSES
shahzadebaujiti
ย 
ENVIRONMENTAL ISSUES AND CONSERVATION
ENVIRONMENTAL ISSUES AND CONSERVATIONENVIRONMENTAL ISSUES AND CONSERVATION
ENVIRONMENTAL ISSUES AND CONSERVATION
shahzadebaujiti
ย 
TRANSPORT AND COMMUNICATION
TRANSPORT AND COMMUNICATIONTRANSPORT AND COMMUNICATION
TRANSPORT AND COMMUNICATION
shahzadebaujiti
ย 
MANUFACTURING INDUSTRY
MANUFACTURING INDUSTRYMANUFACTURING INDUSTRY
MANUFACTURING INDUSTRY
shahzadebaujiti
ย 
RIVER BASIN DEVELOPMENT
RIVER BASIN DEVELOPMENTRIVER BASIN DEVELOPMENT
RIVER BASIN DEVELOPMENT
shahzadebaujiti
ย 
REGIONAL FOCAL STUDIES - 5.7 ENVIRONMENTAL FRIENDLY TOURISM
REGIONAL FOCAL STUDIES - 5.7 ENVIRONMENTAL FRIENDLY TOURISMREGIONAL FOCAL STUDIES - 5.7 ENVIRONMENTAL FRIENDLY TOURISM
REGIONAL FOCAL STUDIES - 5.7 ENVIRONMENTAL FRIENDLY TOURISM
shahzadebaujiti
ย 
REGIONAL FOCAL STUDIES -5.5 SUSTAINABLE USE OF FORESTRY
REGIONAL FOCAL STUDIES -5.5 SUSTAINABLE USE OF FORESTRYREGIONAL FOCAL STUDIES -5.5 SUSTAINABLE USE OF FORESTRY
REGIONAL FOCAL STUDIES -5.5 SUSTAINABLE USE OF FORESTRY
shahzadebaujiti
ย 
REGIONAL FOCAL STUDIES - 5.6 SUSTAINABLE FISHING
REGIONAL FOCAL STUDIES - 5.6 SUSTAINABLE FISHINGREGIONAL FOCAL STUDIES - 5.6 SUSTAINABLE FISHING
REGIONAL FOCAL STUDIES - 5.6 SUSTAINABLE FISHING
shahzadebaujiti
ย 
SUSTAINABLE MINING MINERAL EXTRACTION (MINING INDUSTRY)
SUSTAINABLE MINING  MINERAL EXTRACTION (MINING INDUSTRY)SUSTAINABLE MINING  MINERAL EXTRACTION (MINING INDUSTRY)
SUSTAINABLE MINING MINERAL EXTRACTION (MINING INDUSTRY)
shahzadebaujiti
ย 
SOIL DEGRADATION AND CONSERVATION
SOIL DEGRADATION AND CONSERVATIONSOIL DEGRADATION AND CONSERVATION
SOIL DEGRADATION AND CONSERVATION
shahzadebaujiti
ย 
AGRICULTURAL DEVELOPMENT
AGRICULTURAL DEVELOPMENTAGRICULTURAL DEVELOPMENT
AGRICULTURAL DEVELOPMENT
shahzadebaujiti
ย 
POPULATION AND DEVELOPMENT
POPULATION AND DEVELOPMENTPOPULATION AND DEVELOPMENT
POPULATION AND DEVELOPMENT
shahzadebaujiti
ย 
THE BUSINESS OFFICE
THE BUSINESS OFFICETHE BUSINESS OFFICE
THE BUSINESS OFFICE
shahzadebaujiti
ย 

More from shahzadebaujiti (20)

IMPERIALISM AND TERRITORIAL DIVISION OF THE WORLD (COLONIZATION OF AFRICA)
IMPERIALISM AND TERRITORIAL DIVISION OF THE WORLD (COLONIZATION OF AFRICA)IMPERIALISM AND TERRITORIAL DIVISION OF THE WORLD (COLONIZATION OF AFRICA)
IMPERIALISM AND TERRITORIAL DIVISION OF THE WORLD (COLONIZATION OF AFRICA)
ย 
THE RISE OF DEMOCRACY IN EUROPE
THE RISE OF DEMOCRACY IN EUROPE THE RISE OF DEMOCRACY IN EUROPE
THE RISE OF DEMOCRACY IN EUROPE
ย 
THE RISE OF CAPITALISM IN EUROPE
THE RISE OF CAPITALISM IN EUROPETHE RISE OF CAPITALISM IN EUROPE
THE RISE OF CAPITALISM IN EUROPE
ย 
CLIMATOLOGY CLIMATOLOGY
CLIMATOLOGY CLIMATOLOGYCLIMATOLOGY CLIMATOLOGY
CLIMATOLOGY CLIMATOLOGY
ย 
SUSTAINABLE USE OF FUEL AND POWER
SUSTAINABLE USE OF FUEL AND POWERSUSTAINABLE USE OF FUEL AND POWER
SUSTAINABLE USE OF FUEL AND POWER
ย 
SPACE DYNAMIC
SPACE DYNAMICSPACE DYNAMIC
SPACE DYNAMIC
ย 
PHYSICAL GEOGRAPHY 1.5 -STUDY OF SOIL
PHYSICAL GEOGRAPHY 1.5 -STUDY OF SOILPHYSICAL GEOGRAPHY 1.5 -STUDY OF SOIL
PHYSICAL GEOGRAPHY 1.5 -STUDY OF SOIL
ย 
PHYSICAL GEOGRAPHY 1.4-WATER MASSES
PHYSICAL GEOGRAPHY 1.4-WATER MASSESPHYSICAL GEOGRAPHY 1.4-WATER MASSES
PHYSICAL GEOGRAPHY 1.4-WATER MASSES
ย 
ENVIRONMENTAL ISSUES AND CONSERVATION
ENVIRONMENTAL ISSUES AND CONSERVATIONENVIRONMENTAL ISSUES AND CONSERVATION
ENVIRONMENTAL ISSUES AND CONSERVATION
ย 
TRANSPORT AND COMMUNICATION
TRANSPORT AND COMMUNICATIONTRANSPORT AND COMMUNICATION
TRANSPORT AND COMMUNICATION
ย 
MANUFACTURING INDUSTRY
MANUFACTURING INDUSTRYMANUFACTURING INDUSTRY
MANUFACTURING INDUSTRY
ย 
RIVER BASIN DEVELOPMENT
RIVER BASIN DEVELOPMENTRIVER BASIN DEVELOPMENT
RIVER BASIN DEVELOPMENT
ย 
REGIONAL FOCAL STUDIES - 5.7 ENVIRONMENTAL FRIENDLY TOURISM
REGIONAL FOCAL STUDIES - 5.7 ENVIRONMENTAL FRIENDLY TOURISMREGIONAL FOCAL STUDIES - 5.7 ENVIRONMENTAL FRIENDLY TOURISM
REGIONAL FOCAL STUDIES - 5.7 ENVIRONMENTAL FRIENDLY TOURISM
ย 
REGIONAL FOCAL STUDIES -5.5 SUSTAINABLE USE OF FORESTRY
REGIONAL FOCAL STUDIES -5.5 SUSTAINABLE USE OF FORESTRYREGIONAL FOCAL STUDIES -5.5 SUSTAINABLE USE OF FORESTRY
REGIONAL FOCAL STUDIES -5.5 SUSTAINABLE USE OF FORESTRY
ย 
REGIONAL FOCAL STUDIES - 5.6 SUSTAINABLE FISHING
REGIONAL FOCAL STUDIES - 5.6 SUSTAINABLE FISHINGREGIONAL FOCAL STUDIES - 5.6 SUSTAINABLE FISHING
REGIONAL FOCAL STUDIES - 5.6 SUSTAINABLE FISHING
ย 
SUSTAINABLE MINING MINERAL EXTRACTION (MINING INDUSTRY)
SUSTAINABLE MINING  MINERAL EXTRACTION (MINING INDUSTRY)SUSTAINABLE MINING  MINERAL EXTRACTION (MINING INDUSTRY)
SUSTAINABLE MINING MINERAL EXTRACTION (MINING INDUSTRY)
ย 
SOIL DEGRADATION AND CONSERVATION
SOIL DEGRADATION AND CONSERVATIONSOIL DEGRADATION AND CONSERVATION
SOIL DEGRADATION AND CONSERVATION
ย 
AGRICULTURAL DEVELOPMENT
AGRICULTURAL DEVELOPMENTAGRICULTURAL DEVELOPMENT
AGRICULTURAL DEVELOPMENT
ย 
POPULATION AND DEVELOPMENT
POPULATION AND DEVELOPMENTPOPULATION AND DEVELOPMENT
POPULATION AND DEVELOPMENT
ย 
THE BUSINESS OFFICE
THE BUSINESS OFFICETHE BUSINESS OFFICE
THE BUSINESS OFFICE
ย 

Recently uploaded

Information and Communication Technology in Education
Information and Communication Technology in EducationInformation and Communication Technology in Education
Information and Communication Technology in Education
MJDuyan
ย 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapitolTechU
ย 
Ethiopia and Eritrea Eritrea's journey has been marked by resilience and dete...
Ethiopia and Eritrea Eritrea's journey has been marked by resilience and dete...Ethiopia and Eritrea Eritrea's journey has been marked by resilience and dete...
Ethiopia and Eritrea Eritrea's journey has been marked by resilience and dete...
biruktesfaye27
ย 
How to stay relevant as a cyber professional: Skills, trends and career paths...
How to stay relevant as a cyber professional: Skills, trends and career paths...How to stay relevant as a cyber professional: Skills, trends and career paths...
How to stay relevant as a cyber professional: Skills, trends and career paths...
Infosec
ย 
Diversity Quiz Finals by Quiz Club, IIT Kanpur
Diversity Quiz Finals by Quiz Club, IIT KanpurDiversity Quiz Finals by Quiz Club, IIT Kanpur
Diversity Quiz Finals by Quiz Club, IIT Kanpur
Quiz Club IIT Kanpur
ย 
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptxScience-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Catherine Dela Cruz
ย 
The Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teachingThe Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teaching
Derek Wenmoth
ย 
Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024
Friends of African Village Libraries
ย 
220711130095 Tanu Pandey message currency, communication speed & control EPC ...
220711130095 Tanu Pandey message currency, communication speed & control EPC ...220711130095 Tanu Pandey message currency, communication speed & control EPC ...
220711130095 Tanu Pandey message currency, communication speed & control EPC ...
Kalna College
ย 
220711130100 udita Chakraborty Aims and objectives of national policy on inf...
220711130100 udita Chakraborty  Aims and objectives of national policy on inf...220711130100 udita Chakraborty  Aims and objectives of national policy on inf...
220711130100 udita Chakraborty Aims and objectives of national policy on inf...
Kalna College
ย 
How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17
Celine George
ย 
Decolonizing Universal Design for Learning
Decolonizing Universal Design for LearningDecolonizing Universal Design for Learning
Decolonizing Universal Design for Learning
Frederic Fovet
ย 
Cross-Cultural Leadership and Communication
Cross-Cultural Leadership and CommunicationCross-Cultural Leadership and Communication
Cross-Cultural Leadership and Communication
MattVassar1
ย 
Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024
khabri85
ย 
Keynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse CityKeynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse City
PJ Caposey
ย 
bryophytes.pptx bsc botany honours second semester
bryophytes.pptx bsc botany honours  second semesterbryophytes.pptx bsc botany honours  second semester
bryophytes.pptx bsc botany honours second semester
Sarojini38
ย 
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
yarusun
ย 
A Quiz on Drug Abuse Awareness by Quizzito
A Quiz on Drug Abuse Awareness by QuizzitoA Quiz on Drug Abuse Awareness by Quizzito
A Quiz on Drug Abuse Awareness by Quizzito
Quizzito The Quiz Society of Gargi College
ย 
Talking Tech through Compelling Visual Aids
Talking Tech through Compelling Visual AidsTalking Tech through Compelling Visual Aids
Talking Tech through Compelling Visual Aids
MattVassar1
ย 
220711130088 Sumi Basak Virtual University EPC 3.pptx
220711130088 Sumi Basak Virtual University EPC 3.pptx220711130088 Sumi Basak Virtual University EPC 3.pptx
220711130088 Sumi Basak Virtual University EPC 3.pptx
Kalna College
ย 

Recently uploaded (20)

Information and Communication Technology in Education
Information and Communication Technology in EducationInformation and Communication Technology in Education
Information and Communication Technology in Education
ย 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
ย 
Ethiopia and Eritrea Eritrea's journey has been marked by resilience and dete...
Ethiopia and Eritrea Eritrea's journey has been marked by resilience and dete...Ethiopia and Eritrea Eritrea's journey has been marked by resilience and dete...
Ethiopia and Eritrea Eritrea's journey has been marked by resilience and dete...
ย 
How to stay relevant as a cyber professional: Skills, trends and career paths...
How to stay relevant as a cyber professional: Skills, trends and career paths...How to stay relevant as a cyber professional: Skills, trends and career paths...
How to stay relevant as a cyber professional: Skills, trends and career paths...
ย 
Diversity Quiz Finals by Quiz Club, IIT Kanpur
Diversity Quiz Finals by Quiz Club, IIT KanpurDiversity Quiz Finals by Quiz Club, IIT Kanpur
Diversity Quiz Finals by Quiz Club, IIT Kanpur
ย 
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptxScience-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
ย 
The Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teachingThe Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teaching
ย 
Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024
ย 
220711130095 Tanu Pandey message currency, communication speed & control EPC ...
220711130095 Tanu Pandey message currency, communication speed & control EPC ...220711130095 Tanu Pandey message currency, communication speed & control EPC ...
220711130095 Tanu Pandey message currency, communication speed & control EPC ...
ย 
220711130100 udita Chakraborty Aims and objectives of national policy on inf...
220711130100 udita Chakraborty  Aims and objectives of national policy on inf...220711130100 udita Chakraborty  Aims and objectives of national policy on inf...
220711130100 udita Chakraborty Aims and objectives of national policy on inf...
ย 
How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17
ย 
Decolonizing Universal Design for Learning
Decolonizing Universal Design for LearningDecolonizing Universal Design for Learning
Decolonizing Universal Design for Learning
ย 
Cross-Cultural Leadership and Communication
Cross-Cultural Leadership and CommunicationCross-Cultural Leadership and Communication
Cross-Cultural Leadership and Communication
ย 
Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024
ย 
Keynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse CityKeynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse City
ย 
bryophytes.pptx bsc botany honours second semester
bryophytes.pptx bsc botany honours  second semesterbryophytes.pptx bsc botany honours  second semester
bryophytes.pptx bsc botany honours second semester
ย 
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
Get Success with the Latest UiPath UIPATH-ADPV1 Exam Dumps (V11.02) 2024
ย 
A Quiz on Drug Abuse Awareness by Quizzito
A Quiz on Drug Abuse Awareness by QuizzitoA Quiz on Drug Abuse Awareness by Quizzito
A Quiz on Drug Abuse Awareness by Quizzito
ย 
Talking Tech through Compelling Visual Aids
Talking Tech through Compelling Visual AidsTalking Tech through Compelling Visual Aids
Talking Tech through Compelling Visual Aids
ย 
220711130088 Sumi Basak Virtual University EPC 3.pptx
220711130088 Sumi Basak Virtual University EPC 3.pptx220711130088 Sumi Basak Virtual University EPC 3.pptx
220711130088 Sumi Basak Virtual University EPC 3.pptx
ย 

PROBLEM SOLVING

  • 1. PROBLEM SOLVING Programming To solve a computing problem, its solution must be specified in terms of sequence of computational steps such that they are effectively solved by a human agent or by a digital computer. Programming Language 1) The specification of the sequence of computational steps in a particular programming language is termedas a program 2) The task of developing programs is calledprogramming 3) The personengaged in programming activity is calledprogrammer Techniques of Problem Solving Problem solving an art in that it requires enormous intuitive power & a science for it takes a pragmatic approach. Here a rough outline of a general problem solving approach. 1) Write out the problem statement include information on what you are to solve & consider why you needto solve the problem 2) Make sure you are solving the real problem as opposed to the perceived problem. To checkto see that you define & solve the real problem 3) Draw & label a sketch. Define & name all variables and /or symbols. Show numerical values of variables, if known. 4) Identify & Name a. relevant principles, theories& equations b. system & subsystems c. dependent & independent variables d. known & unknowns e. inputs & outputs f. necessaryinformation 5) List assumptions and approximations involved in solving the problem. Question the assumptions and then state which ones are the most reasonable for your purposes. 6) Check to see if the problem is either under-specified, figure out how to find the missing information. If over-specified, identify the extra information that is not needed. 7) Relate problem to similar problem or experience 8) Use an algorithm
  • 2. 9) Evaluate and examine and evaluate the answer to see it makes sense. Introductionto C Programming C is a general-purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. C is a structured programming language, which means that it allows you to develop programs using well-defined control structures (you will learn about control structures in the articles to come), and provides modularity (breaking the task into multiple sub tasks that are simple enough to understand and to reuse).C is often called a middle-level language because it combines the best elements of low-level or machine language with high-level languages. Where is C useful? Cโ€™s ability to communicate directly with hardware makes it a powerful choice for system programmers. In fact, popular operating systems such as Unix and Linux are written entirely in C. Additionally, even compilers and interpreters for other languages such as FORTRAN, Pascal, and BASIC are written in C. However, Cโ€™s scope is not just limited to developing system programs. It is also used to develop any kind of application, including complex business ones. The followingis a partial list of areas where C language is used: - Embedded Systems - Systems Programming - Artificial Intelligence - Industrial Automation - Computer Graphics - Space Research Why you shouldlearnC? You should learnC because: ยท C is simple. ยท There are only 32 keywords so C is very easy to master. Keywords are words that have special meaning in C language.
  • 3. ยท C programs run faster than programs written in most other languages. ยท C enables easy communication with computer hardware making it easy to write system programs such as compilers andinterpreters. WHY WE NEED DATA AND A PROGRAM Any computer program has two entities to consider, the data, and the program. They are highly dependent on one another and careful planning of both will lead to a well planned and well written program. Unfortunately, it is not possible to study either completely without a good working knowledge of the other. For that reason, this tutorial will jump back and forth between teaching methods of program writing and methods of data definition. Simply follow along and you will have a good understanding of both. Keep in mind that, even though it seems expedient to sometimes jump right into coding the program, time spent planning the data structures will be well spent and the quality of the final program will reflect the original planning How to run a simple c program 1. Copy Turbo c/c++ incomputer 2. Open c:tcbintc.axe 3. A window appears 4. Select File->newto opena new file 5. Type the followingprogram on editor #include void main() { print f(โ€œhelloโ€); }
  • 4. 6. compile the program by pressingALT+F9 7. Run the program by pressingCTRL +F9 Note: 1. C is case sensitive 2. Always terminate statementswithsemicolon. 3. A program starts with main() Explanationofprogram #include is known as compiler directive. A compiler directive is a command to compiler to translate the program in a certain way. These statement are not converted into machine language but only perform some othertask. main() is a function which the staring point for compiler to start compilation. So a function must containa main() function. DETECTION AND CORRECTION OF ERRORS Syntactic errors and execution errors usually result in the generation of error messages when compiling or executing a program. Error of this type is usually quite easy to find and correct. There are some logical errors that can be very difficult to detect. Since the output resulting from a logically incorrect program may appear to be error free. Logical errors are often hard to find, so in order to find and correct errors of this type is known as logical debugging. To detect errors test a new program with data that will give a known answer. If the correct results are not obtained then the program obviously contains errors even if the correct results are obtained. Computer Applications: However you cannot be sure that the program is error free, since some errors cause incorrect result only under certain circumstances. Therefore a new program should receive thorough testing before it is considered to be debugged. Once it has been established that a program contains a logical error, some ingenuity may be required to find the error. Error detection should always begin with a thorough review of each logical group of statements within the program. If the error cannot be found, it sometimes helps to set the program aside for a while. If an error cannot be located simply by inspection, the
  • 5. program should be modified to print out certain intermediate results and then be rerun. This technique is referred to as tracing. The source of error will often become evident once these intermediate calculations have been carefully examined. The greater the amount of intermediate output, the more likely the chances of pointing the source of errors. Sometimes an error simply cannot be located. Some C compilers include a debugger, which is a special program that facilitates the detection of errors in C programs. In particular a debugger allows the execution of a source program to be suspended at designated places, called break points, revealing the values assigned to the program variables and array elements at the time execution stops. Some debuggers also allow a program to execute continuously until some specified error condition has occurred. By examining the values assigned to the variables at the break points, it is easier to determine whenand where an error originates. Linear Programming Linear program is a method for straightforward programming in a sequential manner. This type of programming does not involve any decision making. General model of these linear programs is: 1. Read a data value 2. Computer an intermediate result 3. Use the intermediate result to computer the desiredanswer 4. Print the answer 5. Stop StructuredProgramming Structured programming (sometimes known as modular programming) is a subset of procedural programming that enforces a logical structure on the program being written to make it more efficient and easier to understand and modify. Certain languages such as Ada, Pascal, and BASE are designed with features that encourage or enforce a logical program structure. Structured programming frequently employs a top-down design model, in which developers map out the overall program structure into separate subsections. A defined function or set of similar functions is coded in a separate module or sub module, which means that code can be loaded into memory more efficiently and that modules can be reused in other programs. After a module has been tested individually, it is then integrated with other modules into the overall program structure. Advantages of StructuredProgramming
  • 6. 1. Easy to write: Modular design increases the programmer's productivity by allowing them to look at the big picture first and focus on details later.Several Programmers can work on a single, large program, each working on a different module. Studies show structured programs take less time to write than standard programs. Procedures written for one program can be reused in other programs requiring the same task. A procedure that can be used in many programs is said to be reusable. 2. Easy to debug: Since each procedure is specialized to perform just one task, a procedure can be checked individually. Older unstructured programs consist of a sequence of instructions that are not grouped for specific tasks. The logic of such programs is clutteredwithdetails and therefore difficultto follow. 3. Easy to Understand: The relationship between the procedures shows the modular design of the program. Meaningful procedure names and clear documentation identify the task performed by each module. Meaningful variable names help the programmer identify the purpose of each variable. 4. Easy to Change: Since a correctly written structured program is self-documenting, it can be easily understoodby another programmer. StructuredProgramming Constructs It uses only three constructs - ยท Sequence (statements, blocks) ยท Selection(if, switch) ยท Iteration(loops like while and for) Sequence ยท Any valid expressionterminatedbya semicolonis a statement. ยท Statements may be grouped together by surrounding them with a pair of curlybraces. ยท Such a group is syntactically equivalent to one statement and can be inserted where ever ยท One statement is legal. Selection
  • 7. The selection constructs allow us to follow different paths in different situations. We may also think of them as enabling us to express decisions. The main selectionconstructis: if (expression) statement1 else statement2 statement1 is executed if and only if expression evaluates to some non-zero number. If expression evaluates to 0, statement1 is not executed. Inthat case, statement2 is executed. If and else are independent constructs, in that if can occur without else (but not the reverse)Any else is paired with the most recent else-less if, unless curly braces enforce a different scheme. Note that only curly braces, not parentheses, must be used to enforce the pairing. Parentheses Iteration Looping is a way by which we can execute any some set of statements more than one times continuously.In C there are mainly three types of loops are used : ยท while Loop ยท do while Loop ยท For Loop The control structuresare easyto use because of the followingreasons: 1) They are easyto recognize 2) They are simple to deal with as they have just one entry and one exit point 3) They are free of the complications of anyparticular programming language
  ็ฟป่ฏ‘๏ผš