SlideShare a Scribd company logo
1 of 48
Overview
 Introduction to Computer
 Program and Programming Languages
 Types of Programming Languages
 Low-Level Languages
 Assembly languages
 High-Level Languages
 History of Programming Languages
 Translators
 Compiler
 Interpreter
 Typical C Program Development Environment
 The C Programming Language
 Characteristics of C language
 Basic Program Structure in C Language
1
Introduction
 Computer
A computer is an electronic device which is capable to
• receive the data,
• process the data, and
• provide results
according to a set of instructions
 Program
A program is a set of instructions of a computer language, where each
instruction tells the computer to do something:
For example,
• get two numbers as input,
• add these numbers,
• print the sum as output
2
Programming Languages
 Programming Language
 A programming language defines the rules for writing instructions
 Programmers write instructions in a programming language
 Types of Programming Languages
A number of programming languages are in use today and are
generally categorized as follows:
 Low-Level Languages
 Assembly languages
 High-Level Languages
3
Types of Languages
 Low-Level language or Machine/Binary Language
 This language consists of binary numbers to perform a task
 Machine language is directly understandable to the computer
 Machine languages are machine dependent (i.e., a particular machine
language can be used on only one type of computer)
 Programming in machine-language is very slow, tiresome and error prone
for the programmers
4
Types of Languages
 Assembly language
 It was developed to overcome the problems with machine language
 Assembly language uses English-like abbreviations to programming, such as
ADD for adding numbers
 As the assembly language is not the machine own’s language, so translators
were developed called assemblers
 Assemblers translate the assembly-language programs into the machine
language programs
5
Types of Languages
 High level language
 In early programming languages, the programmers had to write many
instructions to perform a single task
 The high-level languages use a single instruction to perform many tasks
 Compilers or interpreters are used as translators to convert high-level
language programs into machine language
 C, C++, Visual Basic, Visual C++, Visual C#, Python and Java are the most
commonly used high-level programming languages today
6
Types of translators
 Compiler
 Interpreter
7
Translators and Types
 Translator
 A translator is used convert a high level language program
(source code) into machine language (object code)
Source code object code
 Types of translators
 Compiler
 Interpreter
8
Compiler vs. Interpreter
 Compiler
 A compiler first reads the whole source code, and converts
it into a its equivalent machine language, if there are no
errors(bugs)
 Reports a list of errors, if errors in the source code
 Faster translation
 C, C++, C# etc. are the examples of compiled languages
9
Compiler vs. Interpreter
 Interpreter
 An interpreter performs line by line translation
 It first reads the first line of the source code, and converts it into a its
equivalent machine code (if no error), then the second line, and so on
 If there is error, it reports it and the user has to correct it, and after this,
the source code to object code translation occurs
 Slower translation than compiler
 Java, Python etc. are called interpreted languages
10
Why study programming Languages?
 In 1967, Sammet, an American computer scientist and one of the
developers of the COBOL programming language, reported 120
programming languages commonly used
 Today , these languages are many more
 Most programmers never use more than a few, some limit their
career to just on or two
 The goal in learning about a language is its fundamental design
concepts and how this affects its implementation
11
12
https://www.tiobe.com/tiobe-index/
Programming Languages Popularity
Programming Domains
 Scientific applications(Fortran)
 Business Applications(COBOL)
 Artificial Intelligence(LISP, Prolog)
 System Programming(C )
 Web software (HTML, PHP, Java)
 General Purpose (Python)
13
14
The Ideal Way to Do Computing
 The ideal way to ask computer to do something is to order it in a
natural language e.g.
 I want to view this webpage
 Calculate my annual tax
 etc.
 However, today’s computer’s are not intelligent enough to
understand our orders in natural language
15
Where We Are in Computers?
 At the very basic level, computers use the concept of an electrical pulse
 Low voltage is represented as 0
 High voltage is represented as 1
 To instruct a computer, we need ask the computer in the language of 0s and
1s commonly known as machine language
 For example, 5 is a number in natural language, so in the language of
0s and 1s, it becomes 101
 In Today’s computing, we use a high-level language to instruct the
computer
 The compiler translates these instructions into the machine language
16
Where are we going?
 The next step in computing is to use natural language over a high-level
language
 But we are many more years away from it
 A lot of research needs to be carried out before we actually see this
 Until then our task is to use high-level languages in its best possible
ways
Program & Its Various Aspects
17
18
What is Programming?
 When we say “programming” we are actually referring
to the science of transforming our intentions in a
high-level programming language
19
Many Aspects of Programming
 Programming is controlling
 computer does exactly what you tell it to do
 Programming is teaching
 computer can only “learn” to do new things if you tell it how
 Programming is problem solving
 always trying to make computer do something useful — i.e., finding
an optimal travel route
 Programming is creative
 must find a good solution out of many possibilities
20
Many Aspects of Programming
 Programming is modelling
 describe salient (relevant) properties and behaviours of a system
of components (objects)
 Programming is abstraction
 identify important features without getting lost in detail
 Programming is concrete
 must provide detailed instructions to complete task
C-Language
 History & characteristics of C language
21
History of C language
 C language was developed by Dennis Ritchie and Ken Thompson in
1972 at Bell Labs where they were working on Unix Operating System
 Dennis Ritchie is known as the founder of the C language
 C was developed to add additional features to its earlier
languages such as B, BCPL, etc.
 It inherits many features of B and BCPL languages
22
Characteristics of C language
1. C is a General Purpose Programming Language
- This means that C language can be used to write a variety of
applications
2. C is a structured programming language
- This means that when you program in C language, a problem is
divided into several small units called functions
3. C is a simple language
- This means that C language is easy to use and has a vast
collection of keywords, operators, built-in functions and data
types
23
Characteristics of C language
4. C is case sensitive language
- This means that in C language the lower case letters are
different from upper case letters
5. C is portable language
-This means that a program written in C language can be run on
different hardware platforms
24
Characteristics of C language
6.C is a flexible language
-This means that C language can be used like a high level
language and like a low level language
7. C is easily available language
-The C software is easy to access and can be easily installed
on a user computer within a few minutes
25
Characteristics of C language
8. C is easily debugged language
 The C is easy to debug
 The C compiler detects syntax errors quickly and easily and
displays the errors along with the line numbers of the code and
the error message
9. C has a number of in-built memory management functions that save
memory and improve the efficiency of the program
10. C has a rich set of library functions for various arithmetic and
trigonometric calculations
26
C-Program Development Environment
(IDE)
27
C IDE
 A C program development environment is called IDE(Integrated
Development Environment)
 Many IDEs available today and some are as follows
 DEVCpp
 Microsoft Visual Studio
 Eclipse
 NetBeans
 Code::Blocks
 etc.
 We use DEVCpp, for C program development in this course
28
C Program Execution Phases
 C program goes through six phases to be executed. These
are as follows:
 Edit
 Preprocess
 Compile
 Link
 Load
 Execute
29
C Program Execution Phases
30
C Program Execution Phases
31
Execution Phases
 Phase 1: Editing/Creating a Program
 Phase 1 consists of editing a file
 To edit a file, we use Dev C++ IDE
 A C program is typed or coded in the IDE
 After coding, the program is stored on a hard disk
 A C program file name should end with the .c extension
 Phases 2 : Preprocessing the Program
 In C language, a preprocessor program is executed automatically
before compilation begins
 Here the C preprocessor calls the preprocessor directives(e.g.
#include<…>)
32
Execution Phases
 Phases 3 : Compiling the Program
 The compiler translates the c program code called source code into
machine language-code called object code
 The compiler translates the C program into machine-language code
 To compile the program, we use the compile command in the IDE
 Phase 4: Linking
 A linker links the object code for the missing functions to produce an
executable image
33
Execution Phases
 Phase 5: Loading
 Before a program can be executed, the program must first be placed in
memory
 This is done by the loader, which takes the executable image from disk
and transfers it to memory
 Additional components from shared libraries that support the program
are also loaded
 Phase 6: Execution
 Finally, the computer, under the control of its CPU, executes the
program one instruction at a time
 To load and execute the program, we run the program in the IDE
34
Basic Program Structure in C
35
Basic Program Structure in C Language
36
#include<stdio.h>
int main()
{
// program statement_1;
// program statement_2
…
return 0;
}
Writing Program in C using DEVCpp IDE
37
Steps to follow:
1. Click on File
2. Select New, and
3. Click on Source File
4. Start coding in the source file(in the figure, sample example)
5. Save it with a name(e.g., first.c)
6. Compile, and
7. Run
Writing Program in C using DEVCpp IDE
38
Sample
Program
C Program Example
#include<stdio.h>
int main()
{
printf("Welcome to C language");
return 0;
}
39
Program output:
Welcome to C language
Example: A simple C Program
#include<stdio.h>
int main()
{
printf("Welcome Studentsn");
Printf(“This is C language statement”);
return 0;
}
40
Program output:
Welcome Students
This is C language statement
Escape Sequence in C
41
Escape sequence
 Escape sequence is a set of characters followed by backslash (),
which has a particular meaning for the compiler to do something
with the output statement
 For example, the escape sequence n means newline, which causes
the cursor to position to the beginning of the next line on the
screen
 C language supports the following escape sequences
42
Escape sequence
43
b for backspace, remove one character at the back
’ single quote, insert a single-quote character in a string
Escape Sequence Example
#include<stdio.h>
int main()
{
printf(“This isn C language statement n”);
printf(“Thist ist Ct languaget statement n”);
printf(“ Thisa isa Ca languagea statement n”);
printf(“ ab n”);
printf(“ This is ”C language” statement n”);
printf(“ ’A’ for Apple n”);
printf(“ Hib n”);
return 0;
}
44
Escape Sequence Example…
45
Program output:
This is
C language statement
This is C language statement
This (alert) is (alert) C (alert) language (alert) statement
ab
This is ”C language” statement
‘A’ for Apple
H
Program Comments in C
46
Comments
 Comments are used to document a program:
 Improve program readability and help other people read and understand
your program
 Dot cause the computer to perform any action when the program is run
 Ignored by the C compiler and do not cause any machine-language object
code to be generated
 Types of Comments:
 Single-line comments e.g. //This is first C program
 Multi-line comments e.g. /* This is first C program
Author: Ali
Dated: October 20, 2020 */
47
Example: Comments
// A first program in C
/* Author: Ali
Dated: October 05, 2020
*/
#include<stdio.h>
int main()
{
printf(“This is C language statement”);
return 0;
}
48
Program output:
This is C language statement

More Related Content

What's hot

Computer languages
Computer languagesComputer languages
Computer languagesAqdasNoor
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languagesNaqashAhmad14
 
Types of Programming Languages
Types of Programming LanguagesTypes of Programming Languages
Types of Programming LanguagesJuhi Bhoyar
 
Computer and its language
Computer and its languageComputer and its language
Computer and its languageAkshitKumar72
 
Presentation on generation of languages
Presentation on generation of languagesPresentation on generation of languages
Presentation on generation of languagesRicha Pant
 
4 evolution-of-programming-languages
4 evolution-of-programming-languages4 evolution-of-programming-languages
4 evolution-of-programming-languagesRohit Shrivastava
 
C programming presentation for university
C programming presentation for universityC programming presentation for university
C programming presentation for universitySheikh Monirul Hasan
 
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming ConceptsJussi Pohjolainen
 
pdf c programming language.pdf
pdf c programming language.pdfpdf c programming language.pdf
pdf c programming language.pdfVineethReddy560178
 
Chapter 1 - An Introduction to Programming
Chapter 1 - An Introduction to ProgrammingChapter 1 - An Introduction to Programming
Chapter 1 - An Introduction to Programmingmshellman
 
Introduction with Programming Language
Introduction with Programming LanguageIntroduction with Programming Language
Introduction with Programming LanguageSaroar Zahan Sojib
 
Program & language generation
Program & language generationProgram & language generation
Program & language generationBuxoo Abdullah
 
Introduction To Computer Programming
Introduction To Computer ProgrammingIntroduction To Computer Programming
Introduction To Computer ProgrammingHussain Buksh
 
Introduction to programming with c,
Introduction to programming with c,Introduction to programming with c,
Introduction to programming with c,Hossain Md Shakhawat
 

What's hot (20)

Computer languages
Computer languagesComputer languages
Computer languages
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languages
 
Types of Programming Languages
Types of Programming LanguagesTypes of Programming Languages
Types of Programming Languages
 
Computer and its language
Computer and its languageComputer and its language
Computer and its language
 
Presentation on generation of languages
Presentation on generation of languagesPresentation on generation of languages
Presentation on generation of languages
 
C programming
C programmingC programming
C programming
 
4 evolution-of-programming-languages
4 evolution-of-programming-languages4 evolution-of-programming-languages
4 evolution-of-programming-languages
 
C programming presentation for university
C programming presentation for universityC programming presentation for university
C programming presentation for university
 
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming Concepts
 
pdf c programming language.pdf
pdf c programming language.pdfpdf c programming language.pdf
pdf c programming language.pdf
 
C program
C programC program
C program
 
Chapter 1 - An Introduction to Programming
Chapter 1 - An Introduction to ProgrammingChapter 1 - An Introduction to Programming
Chapter 1 - An Introduction to Programming
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Introduction with Programming Language
Introduction with Programming LanguageIntroduction with Programming Language
Introduction with Programming Language
 
Rajesh ppt
Rajesh pptRajesh ppt
Rajesh ppt
 
Program & language generation
Program & language generationProgram & language generation
Program & language generation
 
Introduction To Computer Programming
Introduction To Computer ProgrammingIntroduction To Computer Programming
Introduction To Computer Programming
 
Computer Programming
Computer ProgrammingComputer Programming
Computer Programming
 
Introduction to programming with c,
Introduction to programming with c,Introduction to programming with c,
Introduction to programming with c,
 

Similar to Introduction to Computer

Introduction to Computer Programming (general background)
Introduction to Computer Programming (general background)Introduction to Computer Programming (general background)
Introduction to Computer Programming (general background)Chao-Lung Yang
 
Software programming and development
Software programming and developmentSoftware programming and development
Software programming and developmentAli Raza
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programmingNoel Malle
 
Fundamental of Information Technology - UNIT 7
Fundamental of Information Technology - UNIT 7Fundamental of Information Technology - UNIT 7
Fundamental of Information Technology - UNIT 7Shipra Swati
 
C Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDYC Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDYRajeshkumar Reddy
 
Learn c programming language in 24 hours allfreebooks.tk
Learn c programming language in 24 hours   allfreebooks.tkLearn c programming language in 24 hours   allfreebooks.tk
Learn c programming language in 24 hours allfreebooks.tkragulasai
 
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfINTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfSubramanyambharathis
 
Introduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem AnsariIntroduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem AnsariTech
 

Similar to Introduction to Computer (20)

CS3251-_PIC
CS3251-_PICCS3251-_PIC
CS3251-_PIC
 
C.pdf
C.pdfC.pdf
C.pdf
 
Lecture 1-3.ppt
Lecture 1-3.pptLecture 1-3.ppt
Lecture 1-3.ppt
 
Programming in c
Programming in cProgramming in c
Programming in c
 
Programming in C
Programming in CProgramming in C
Programming in C
 
Introduction to Computer Programming (general background)
Introduction to Computer Programming (general background)Introduction to Computer Programming (general background)
Introduction to Computer Programming (general background)
 
Ppt 1
Ppt 1Ppt 1
Ppt 1
 
Software programming and development
Software programming and developmentSoftware programming and development
Software programming and development
 
Programming in c
Programming in cProgramming in c
Programming in c
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 
Unit 1
Unit 1Unit 1
Unit 1
 
Fundamental of Information Technology - UNIT 7
Fundamental of Information Technology - UNIT 7Fundamental of Information Technology - UNIT 7
Fundamental of Information Technology - UNIT 7
 
Introduction to c language
Introduction to c language Introduction to c language
Introduction to c language
 
C lecture notes new
C lecture notes newC lecture notes new
C lecture notes new
 
C Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDYC Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDY
 
Learn c programming language in 24 hours allfreebooks.tk
Learn c programming language in 24 hours   allfreebooks.tkLearn c programming language in 24 hours   allfreebooks.tk
Learn c programming language in 24 hours allfreebooks.tk
 
C programme presentation
C programme presentationC programme presentation
C programme presentation
 
Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2
 
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfINTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
 
Introduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem AnsariIntroduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem Ansari
 

Recently uploaded

ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxruthvilladarez
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
EMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxEMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxElton John Embodo
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 

Recently uploaded (20)

ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docx
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
EMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxEMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docx
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 

Introduction to Computer

  • 1. Overview  Introduction to Computer  Program and Programming Languages  Types of Programming Languages  Low-Level Languages  Assembly languages  High-Level Languages  History of Programming Languages  Translators  Compiler  Interpreter  Typical C Program Development Environment  The C Programming Language  Characteristics of C language  Basic Program Structure in C Language 1
  • 2. Introduction  Computer A computer is an electronic device which is capable to • receive the data, • process the data, and • provide results according to a set of instructions  Program A program is a set of instructions of a computer language, where each instruction tells the computer to do something: For example, • get two numbers as input, • add these numbers, • print the sum as output 2
  • 3. Programming Languages  Programming Language  A programming language defines the rules for writing instructions  Programmers write instructions in a programming language  Types of Programming Languages A number of programming languages are in use today and are generally categorized as follows:  Low-Level Languages  Assembly languages  High-Level Languages 3
  • 4. Types of Languages  Low-Level language or Machine/Binary Language  This language consists of binary numbers to perform a task  Machine language is directly understandable to the computer  Machine languages are machine dependent (i.e., a particular machine language can be used on only one type of computer)  Programming in machine-language is very slow, tiresome and error prone for the programmers 4
  • 5. Types of Languages  Assembly language  It was developed to overcome the problems with machine language  Assembly language uses English-like abbreviations to programming, such as ADD for adding numbers  As the assembly language is not the machine own’s language, so translators were developed called assemblers  Assemblers translate the assembly-language programs into the machine language programs 5
  • 6. Types of Languages  High level language  In early programming languages, the programmers had to write many instructions to perform a single task  The high-level languages use a single instruction to perform many tasks  Compilers or interpreters are used as translators to convert high-level language programs into machine language  C, C++, Visual Basic, Visual C++, Visual C#, Python and Java are the most commonly used high-level programming languages today 6
  • 7. Types of translators  Compiler  Interpreter 7
  • 8. Translators and Types  Translator  A translator is used convert a high level language program (source code) into machine language (object code) Source code object code  Types of translators  Compiler  Interpreter 8
  • 9. Compiler vs. Interpreter  Compiler  A compiler first reads the whole source code, and converts it into a its equivalent machine language, if there are no errors(bugs)  Reports a list of errors, if errors in the source code  Faster translation  C, C++, C# etc. are the examples of compiled languages 9
  • 10. Compiler vs. Interpreter  Interpreter  An interpreter performs line by line translation  It first reads the first line of the source code, and converts it into a its equivalent machine code (if no error), then the second line, and so on  If there is error, it reports it and the user has to correct it, and after this, the source code to object code translation occurs  Slower translation than compiler  Java, Python etc. are called interpreted languages 10
  • 11. Why study programming Languages?  In 1967, Sammet, an American computer scientist and one of the developers of the COBOL programming language, reported 120 programming languages commonly used  Today , these languages are many more  Most programmers never use more than a few, some limit their career to just on or two  The goal in learning about a language is its fundamental design concepts and how this affects its implementation 11
  • 13. Programming Domains  Scientific applications(Fortran)  Business Applications(COBOL)  Artificial Intelligence(LISP, Prolog)  System Programming(C )  Web software (HTML, PHP, Java)  General Purpose (Python) 13
  • 14. 14 The Ideal Way to Do Computing  The ideal way to ask computer to do something is to order it in a natural language e.g.  I want to view this webpage  Calculate my annual tax  etc.  However, today’s computer’s are not intelligent enough to understand our orders in natural language
  • 15. 15 Where We Are in Computers?  At the very basic level, computers use the concept of an electrical pulse  Low voltage is represented as 0  High voltage is represented as 1  To instruct a computer, we need ask the computer in the language of 0s and 1s commonly known as machine language  For example, 5 is a number in natural language, so in the language of 0s and 1s, it becomes 101  In Today’s computing, we use a high-level language to instruct the computer  The compiler translates these instructions into the machine language
  • 16. 16 Where are we going?  The next step in computing is to use natural language over a high-level language  But we are many more years away from it  A lot of research needs to be carried out before we actually see this  Until then our task is to use high-level languages in its best possible ways
  • 17. Program & Its Various Aspects 17
  • 18. 18 What is Programming?  When we say “programming” we are actually referring to the science of transforming our intentions in a high-level programming language
  • 19. 19 Many Aspects of Programming  Programming is controlling  computer does exactly what you tell it to do  Programming is teaching  computer can only “learn” to do new things if you tell it how  Programming is problem solving  always trying to make computer do something useful — i.e., finding an optimal travel route  Programming is creative  must find a good solution out of many possibilities
  • 20. 20 Many Aspects of Programming  Programming is modelling  describe salient (relevant) properties and behaviours of a system of components (objects)  Programming is abstraction  identify important features without getting lost in detail  Programming is concrete  must provide detailed instructions to complete task
  • 21. C-Language  History & characteristics of C language 21
  • 22. History of C language  C language was developed by Dennis Ritchie and Ken Thompson in 1972 at Bell Labs where they were working on Unix Operating System  Dennis Ritchie is known as the founder of the C language  C was developed to add additional features to its earlier languages such as B, BCPL, etc.  It inherits many features of B and BCPL languages 22
  • 23. Characteristics of C language 1. C is a General Purpose Programming Language - This means that C language can be used to write a variety of applications 2. C is a structured programming language - This means that when you program in C language, a problem is divided into several small units called functions 3. C is a simple language - This means that C language is easy to use and has a vast collection of keywords, operators, built-in functions and data types 23
  • 24. Characteristics of C language 4. C is case sensitive language - This means that in C language the lower case letters are different from upper case letters 5. C is portable language -This means that a program written in C language can be run on different hardware platforms 24
  • 25. Characteristics of C language 6.C is a flexible language -This means that C language can be used like a high level language and like a low level language 7. C is easily available language -The C software is easy to access and can be easily installed on a user computer within a few minutes 25
  • 26. Characteristics of C language 8. C is easily debugged language  The C is easy to debug  The C compiler detects syntax errors quickly and easily and displays the errors along with the line numbers of the code and the error message 9. C has a number of in-built memory management functions that save memory and improve the efficiency of the program 10. C has a rich set of library functions for various arithmetic and trigonometric calculations 26
  • 28. C IDE  A C program development environment is called IDE(Integrated Development Environment)  Many IDEs available today and some are as follows  DEVCpp  Microsoft Visual Studio  Eclipse  NetBeans  Code::Blocks  etc.  We use DEVCpp, for C program development in this course 28
  • 29. C Program Execution Phases  C program goes through six phases to be executed. These are as follows:  Edit  Preprocess  Compile  Link  Load  Execute 29
  • 30. C Program Execution Phases 30
  • 31. C Program Execution Phases 31
  • 32. Execution Phases  Phase 1: Editing/Creating a Program  Phase 1 consists of editing a file  To edit a file, we use Dev C++ IDE  A C program is typed or coded in the IDE  After coding, the program is stored on a hard disk  A C program file name should end with the .c extension  Phases 2 : Preprocessing the Program  In C language, a preprocessor program is executed automatically before compilation begins  Here the C preprocessor calls the preprocessor directives(e.g. #include<…>) 32
  • 33. Execution Phases  Phases 3 : Compiling the Program  The compiler translates the c program code called source code into machine language-code called object code  The compiler translates the C program into machine-language code  To compile the program, we use the compile command in the IDE  Phase 4: Linking  A linker links the object code for the missing functions to produce an executable image 33
  • 34. Execution Phases  Phase 5: Loading  Before a program can be executed, the program must first be placed in memory  This is done by the loader, which takes the executable image from disk and transfers it to memory  Additional components from shared libraries that support the program are also loaded  Phase 6: Execution  Finally, the computer, under the control of its CPU, executes the program one instruction at a time  To load and execute the program, we run the program in the IDE 34
  • 36. Basic Program Structure in C Language 36 #include<stdio.h> int main() { // program statement_1; // program statement_2 … return 0; }
  • 37. Writing Program in C using DEVCpp IDE 37 Steps to follow: 1. Click on File 2. Select New, and 3. Click on Source File 4. Start coding in the source file(in the figure, sample example) 5. Save it with a name(e.g., first.c) 6. Compile, and 7. Run
  • 38. Writing Program in C using DEVCpp IDE 38 Sample Program
  • 39. C Program Example #include<stdio.h> int main() { printf("Welcome to C language"); return 0; } 39 Program output: Welcome to C language
  • 40. Example: A simple C Program #include<stdio.h> int main() { printf("Welcome Studentsn"); Printf(“This is C language statement”); return 0; } 40 Program output: Welcome Students This is C language statement
  • 42. Escape sequence  Escape sequence is a set of characters followed by backslash (), which has a particular meaning for the compiler to do something with the output statement  For example, the escape sequence n means newline, which causes the cursor to position to the beginning of the next line on the screen  C language supports the following escape sequences 42
  • 43. Escape sequence 43 b for backspace, remove one character at the back ’ single quote, insert a single-quote character in a string
  • 44. Escape Sequence Example #include<stdio.h> int main() { printf(“This isn C language statement n”); printf(“Thist ist Ct languaget statement n”); printf(“ Thisa isa Ca languagea statement n”); printf(“ ab n”); printf(“ This is ”C language” statement n”); printf(“ ’A’ for Apple n”); printf(“ Hib n”); return 0; } 44
  • 45. Escape Sequence Example… 45 Program output: This is C language statement This is C language statement This (alert) is (alert) C (alert) language (alert) statement ab This is ”C language” statement ‘A’ for Apple H
  • 47. Comments  Comments are used to document a program:  Improve program readability and help other people read and understand your program  Dot cause the computer to perform any action when the program is run  Ignored by the C compiler and do not cause any machine-language object code to be generated  Types of Comments:  Single-line comments e.g. //This is first C program  Multi-line comments e.g. /* This is first C program Author: Ali Dated: October 20, 2020 */ 47
  • 48. Example: Comments // A first program in C /* Author: Ali Dated: October 05, 2020 */ #include<stdio.h> int main() { printf(“This is C language statement”); return 0; } 48 Program output: This is C language statement