2. OBJECTIVES
โข Differentiate between command, Program, and Software
โข Explain the beginning of C
โข Explain when and why C is used
โข Discuss the c program structure
โข Discuss Algorithm
โข Draw Flowcharts
โข List the symbol used in flowcharts
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
2
3. COMMAND, PROGRAM AND SOFTWARE
โข In computing, a command is a directive to a computer program acting as an
interpreter of some kind, in order to perform a specific task.
โข A program is a set of instructions(commands) written in computer language to
provide solution for a particular problem using computing devices is commonly
referred as Program.
โข software is a collection of individual programs well packaged to run on a computer.
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
3
4. COMMAND, PROGRAM AND SOFTWARE
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
4
Software
Program Program
Command Command Command Command
5. BEGINNING OF C
โข C programming language was invented by
Dennis Ritchie at the Bell Laboratories in 1972.
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
5
6. APPLICATION AREAS OF C PROGRAMMING
โข C was initially used for Systems programming
โข A System programs forms a portion of the operating system of the computer or it
support utilities
โข Operating systems, Interpreters, Editors, Assembly programs are usually called
system programs
โข The UNIX operating system was developed using C
โข There are C compilers are available for almost all types of PCโs
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
6
7. MIDDLE LEVEL LANGUAGE
C is called middle-level language because it is actually bind the gap between a
machine level language and high-level languages. User can use c language to do
System Programming (for writing operating system) as well as Application
Programming (for generate menu driven customer billing system ).
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
7
8. STRUCTURED LANGUAGE
โข C is called a structured programming language because to solve a large problem
โข C allows compartmentalization of code and data
โข C programming language divides the problem into smaller modules called
functions or procedures each of which handles a particular responsibility
โข The program which solves the entire problem is a collection of such functions
For Ex: We have to develop a calculator . So we must have to divide programs into
functions of Addition, Subtraction, Multiplication, Division etc.
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
8
9. ABOUT C PROGRAMMING (keywords)
โข There are 32 Keywords in C
โข Keywords are those words whose meaning is already defined by Compiler
โข Keywords cannot be used as a variable or function name
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
9
10. C PROGRAMMING STRUCTURE [ main() ]
๏ฑ C programs are divided into units called functions
๏ฑ Identify the start of program
๏ฑ Every C program has a main ()
๏ฑ Main() is a keyword , we must not used it for any other variable
๏ฑ 4 common ways of main declaration
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
10
11. C PROGRAMMING STRUCTURE[Delimiters]
โข A delimiter is one or more characters that separates text strings
โข Common delimiters are commas (,), semicolon (;), quotes ( ", ' ), braces ({}), pipes (|),
or slashes ( / )
โข C programming Delimiters are as follows
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
11
Delimiter Symbol Use
Colon : Useful for label
Semicolon ; Terminates statements
Parenthesis () Used in expression and function
Square brackets [] Used for array declaration
Curly braces {} Scope of statement
Hash # Preprocessor directive
Comma , variable separator
#include<stdio.h>
void main()
{
int a,b,c[10];
printf("hi");
}
12. C PROGRAMMING STRUCTURE[Comment]
โข In computer programming, a comment is a programmer-readable explanation or
annotation in the source code of a computer program.
โข They are added with the purpose of making the source code easier for humans to
understand, and are generally ignored by compilers and interpreters.
โข In C Comment begin with /* and are terminated with */
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
12
13. THE C LIBRARY
โข All C compilers come with a standard library of functions
โข A function written by a programmer can be placed in the library and used
when required
โข Some compilers allow functions to be added in the standard library
โข Some compilers require a separate library to be created
โข C Standard library functions or simply C Library functions are
inbuilt functions in C programming.
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
13
15. PROGRAMMING APPROACH FOR SOLVING A PROBLEM
What is algorithm ?
Algorithm is a set of instruction performed by programmer to solve a problems
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
15
16. PROGRAMMING APPROACH FOR SOLVING A PROBLEM
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
16
3. Process the information
1. Understand the problem
clearly
4. Arrive the solution
2. Understand the problem
clearly
To solve problems
17. PROGRAMMING APPROACH FOR SOLVING A PROBLEM
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
17
โข Pseudocode is a simple way of writing programming code in English.
โข Pseudocode is not actual programming language.
โข For Example:
1. Start Program
2. Enter two numbers, A, B
3. Add the numbers together
4. Print Sum
5. End Program
Each pseudocode starts with a BEGIN/START To show some value ,
the word DISPLAY/PRINT is used The pseudocode finishes with an END
18. PROGRAMMING APPROACH FOR SOLVING A PROBLEM
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
18
โข What is Flowchart ?
Flowchart is a diagrammatic representation of an algorithm. Flowchart are very helpful
in writing program and explaining program to others.
19. PROGRAMMING APPROACH FOR SOLVING A PROBLEM
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
19
โข Flowchart Symbol
Different symbols are used for different states in flowchart, For example: Input /
Output and decision making has different symbols. The table below describes all the
symbols that are used in making flowchart
20. PROGRAMMING APPROACH FOR SOLVING A PROBLEM
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
20
โข Flowchart to add two numbers?
21. PROGRAMMING APPROACH FOR SOLVING A PROBLEM
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
21
โข Flowchart with If Construct
22. PROGRAMMING APPROACH FOR SOLVING A PROBLEM
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
22
โข Flowchart with If Else
23. PROGRAMMING APPROACH FOR SOLVING A PROBLEM
Presented by: Muhammad Ehtisham Siddiqui (BSCS)
23
โข Flowchart with For Loop