Professional Documents
Culture Documents
Problem Solving Using C Programming: Ece/Ecm
Problem Solving Using C Programming: Ece/Ecm
ECE/ECM
Defining the Software Development Process
Unit-1
Introduction
COURSE OBJECTIVES:
The objectives of this course are:
1. Provide exposure to problem solving through C programming
2. Explore the structure and syntax of C programming language
3. illustrate the applications of data types, operators, arrays, and control flow
statements in problem solving.
4. Demonstrate the usage of procedure-oriented programming.
5. Provide insight into concepts like pointers, structures, and unions
INTRODUCTION
1. COURSE OBJECTIVES:
The objectives of this course are:
1. Provide exposure to problem solving through C programming
2. Explore the structure and syntax of C programming language
3. illustrate the applications of data types, operators, arrays, and control flow
statements in problem solving.
a. Demonstrate the usage of procedure-oriented programming.
b. Provide insight into concepts like pointers, structures, and unions
4
INTRODUCTION
5
WHY NAME 'C' WAS GIVEN TO THIS
LANGUAGE?
Many of the ideas of C language were derived and taken from 'B' language.
BCPL and CPL are previous versions of 'B' language.
As many features came from B it was named as 'C
6
FEATURES OF C
o C is a structured programming language
o C supports functions that enables easy maintainability of code, by
Implementation phase
implement the program in some programming language
8
STEPS IN PROBLEM SOLVING
First produce a general algorithm (one can use pseudo code)
9
PSEUDOCODE & ALGORITHM
o Example 1: Write an algorithm to determine a student’s final grade and indicate whether it is
passing or failing. The final grade is calculated as the average of four marks
Pseudo code:
Input a set of 4 marks
10
DETAILED ALGORITHM
11
THE FLOWCHART
(Dictionary) A schematic representation of a sequence of operations, as in a manufacturing
process or computer program.
12
PSEUDOCODE & ALGORITHM
1.A Flowchart
⚫ shows logic of an algorithm
13
ALGORITHM
1. Algorithm is a step – by – step procedure which is helpful in solving a
problem. If, it is written in English like sentences then, it is called as
‘PSEUDO CODE’.
Properties of an Algorithm
2. An algorithm must possess the following five properties −
• Input
• Output
• Finiteness
• Definiteness
• Effectiveness
14
EXAMPLE
15
16
17
18
FLOWCHART SYMBOLS
Basic
Name Symbol Use in Flowchart
2. C's Keywords
21
THE KEYWORDS
22
Basic Structure Of “C” Programs
#include<stdio.h>
Header Files
#include<conio.h>
Entry Point Of
Program
void main()
Indicates Starting
{ of Program
-- other statements
}
HEADER FILES
The files that are specified in the include section is called as Header File.
These are precompiled files that has some functions defined in them.
24
MAIN FUNCTION
From main function the flow goes as per the programmers choice.
25
RUNNING A ‘C’ PROGRAM
Type a program.
Save it.
Run the program (Actually the exe created out of compilation will run and not
the .c file)
In different compiler we have different option for compiling and running.
26
RUNNING A ‘C’ PROGRAM
Type a program.
Save it.
Run the program (Actually the exe created out of compilation will run and not
the .c file)
In different compiler we have different option for compiling and running.
27
“C” language TOKENS
The smallest individual units in a C program are known
as tokens. In a C source program, the basic element
recognized by the compiler is the "token." A token is source-
program text that the compiler does not break down into
component elements.
C has 6 different types of tokens viz.
1. Keywords [e.g. float, int, while]
2.Identifiers [e.g. main, amount] 3.
Constants [e.g. -25.6, 100]
4. Strings [e.g. “SMIT”, “year”] Strin
gs
31
Click icon to add image Click icon to add image
32
33
34
35
36
Click icon to add image
37
Click icon to add image
38
39
40
41
42
Click icon to add bar Graph
43
Click icon to add bar Graph
44
Click icon to add chart
45
Click icon to add chart
46
47
48
Click icon to add image
Icons
Architecture Commerce Legal Studies Arts & Humanities