0% found this document useful (0 votes)
1 views

UNIT 1 Problem solving with computer

This document outlines the fundamentals of problem-solving with computers, focusing on C programming. It covers problem analysis, algorithms, flowcharts, coding, and debugging, emphasizing the importance of clear algorithms and flowcharts in programming. Additionally, it discusses the advantages and disadvantages of using flowcharts in the coding process.

Uploaded by

kunjandhakal54
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

UNIT 1 Problem solving with computer

This document outlines the fundamentals of problem-solving with computers, focusing on C programming. It covers problem analysis, algorithms, flowcharts, coding, and debugging, emphasizing the importance of clear algorithms and flowcharts in programming. Additionally, it discusses the advantages and disadvantages of using flowcharts in the coding process.

Uploaded by

kunjandhakal54
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

UNIT 1

PROBLEM SOLVING WITH


COMPUTER
(LH - 2 HRS)
PRESENTED BY:
ER. SHARAT MAHARJAN
C PROGRAMMING
CONTENT (LH - 2HRS)
1.1 Problem analysis
1.2 Algorithm and flowchart
1.3 Coding, Compilation and Execution
1.4 History of C
1.5 Structure of C program
1.6 Debugging, Testing and Documentation
1.1 Problem analysis
• Problem analysis is the process of defining a problem and
decomposing overall system into smaller parts to identify possible
inputs, processes and outputs associated with the problem.
• A 'C' program contains various functions which are part of a library.
We can add our features and functions to the library. We can access
and use these functions anytime we want in our program. This
feature makes it simple while working with complex programming.
1.2 Algorithm and Flowchart
Steps to Solve a Problem With the Computer
• Step 1: Problem Definition
• Step 2: Problem Analysis
• Step 3: Designing a program
• Step 4: Coding
• Step 5: Program testing
• Step 6: Installation and Maintenance
Algorithm:
• Algorithm is a step-by-step procedure, which defines a set of
instructions to be executed in a certain order to get the desired
output.
• Algorithms are generally created independent of underlying
languages, i.e. an algorithm can be implemented in more than one
programming language.
Characteristics of an Algorithm
• An algorithm should have the following characteristics:
1. Unambiguous − Algorithm should be clear and unambiguous. Each
of its steps (or phases), and their inputs/outputs should be clear
and must lead to only one meaning.
2. Input − An algorithm should have 0 or more well-defined inputs.
3. Output − An algorithm should have 1 or more well-defined outputs,
and should match the desired output.
4. Finiteness − Algorithms must terminate after a finite number of
steps.
5. Independent − An algorithm should have step-by-step directions,
which should be independent of any programming code.
Problem 1 − Design an algorithm to add two numbers and display the
result.
Step 1 − START

Step 2 − Input a & b

Step 3 − Calculate c = a + b

Step 4 − Display c

Step 5 − STOP
Problem 2 - Design an algorithm to input principal, time and rate and
display the interest.
Problem 3 - Design an algorithm to find largest number among three
numbers.
Problem 4 - Design an algorithm to find sum and average of first n
natural numbers.
Flowchart:
• A flowchart in C language is a graphical representation of an
algorithm.
• Flowchart in C is a diagrammatic representation of a sequence of
logical steps of a program.
• Flowcharts use simple geometric shapes to depict processes and
arrows to show relationships and process/data flow.
Advantages of Flowchart in C:
1. Communication: A flowchart is a better way of communicating the
logic of a program.
2. Efficient Coding: Flowcharts act as a guide for a programmer in
writing the actual code in a high-level language.
3. Proper Debugging: Flowcharts help in the debugging process.
4. Effective Analysis: Effective analysis of logical programs can be
easily done with the help of a related flowchart.
5. Testing: A flowchart helps in the testing process.
Disadvantages of Flowchart in C:
1. Time-consuming: Designing a flowchart is a very time-consuming
process.
2. Complex: It isn't easy to draw a flowchart for large and complex
programs.
3. Difficult to modify: It is very difficult to modify the existing
flowchart.
1. Draw a flowchart to add two numbers:
2. Draw a flowchart to input principal, time and rate and display
interest.
3. Draw a flowchart to find largest among three numbers.
4. Draw a flowchart to find sum of n natural numbers.

F
THANK YOU FOR YOUR ATTENTION

You might also like