SlideShare a Scribd company logo
1 of 29
Download to read offline
1 | P a g e
S.NO TOPIC PAGE NUMBER
1. Computer systems 2
2. computer number systems 6
3. Computer Languages 15
4. Background and characteristics of C 18
5. Algorithms & Flowchart 21
6. pseudo code 23
7. Structure of a C Program 24
8. Input/output Statements in C 25
9. Compiling and executing C programs. 28
UNIT-1
Introduction to computers: Computer systems, computer Languages, computer number systems.
Introduction to C programming: Background and characteristics of C, Flow Charts, algorithms and
pseudo code. Structure of a C Program, Input/output Statements in C, writing C programs, compiling
and executing C programs.
2 | P a g e
1. Computer systems:
What is a Computer?
The computer is an electronic device which operates under the control of instructions stored in its memory.
A computer can take data from the user through input devices (Input), process the user given data
(Processing), produces the result to the user through output devices (Output)and stores data (Information)
for future use.
A Computer can be defined as follows...
The Computer is an electronic device which operates under the control of instructions stored in its memory
and it takes the data from the user, a process that data gives the result and stores the result for future use.
Every computer mainly consists of three things and those are...
1. Hardware
2. Software
3. User
History of computers:
3 | P a g e
The computer hardware components are as follows...
1. Input Devices - These are the parts through which a user can give the data to the computer.
2. Output Devices - These are the physical components of a computer through which the computer
gives the result to the user.
3. Storage Devices - These are the physical components of a computer in which the data can be
stored.
4. Devices Drives - Using drives, user can read and write data on to the storage devices like CD,
floppy, etc.,
5. Cables - Various cables (Wires) are used to make connections in a computer
6. Other Devices - Other than the above hardware components, a computer also contains components
like Motherboard, CPU (Processor), SMPS, Fans, etc.,
Input Devices
Computer input devices are the physical components of the computer which are used to give the data given
by the user to the computer. Using input devices the user can give the data to the computer.
Example
Output Devices: Computer output devices are the physical components of the computer which are used to
give the computer result to the User. Using output devices, the user can see the computer-generated result.
Example
Storage Devices: Computer storage devices are the physical components of the computer which are used to
store data internally or externally.
Example
4 | P a g e
Device Drives: Computer Device drives are the physical components of the computer which are used to
read and write data on the storage devices.
Example
Computer Cables: In a Computer, various cables are used to make connections among the various
hardware components of the computer.
Example
Other Devices: Other devices of the computer are shown below...
CPU (Processor)
5 | P a g e
SMPS
CPU Fan (Heat Sink)
Motherboard
6 | P a g e
2. Computer number systems:
Electronic and Digital systems may use a variety of different number systems, (e.g. Decimal, Hexadecimal,
Octal, Binary).
Conversions:
Decimal Conversions:
1. Binary to Decimal
2. Octal to Decimal
3. Hexadecimal to Decimal
Binary To Decimal Conversion:
7 | P a g e
•
• Technique
– Multiply each bit by 2n
, where n is the “weight” of the bit
– The weight is the position of the bit, starting from 0 on the right
– Add the results
Example:
Octal To Decimal Conversion:
• Technique
– Multiply each bit by 8n
, where n is the “weight” of the bit
– The weight is the position of the bit, starting from 0 on the right
– Add the results
Example:
HexaDecimal to decimal:
8 | P a g e
• Technique
– Multiply each bit by 16n
, where n is the “weight” of the bit
– The weight is the position of the bit, starting from 0 on the right
-- Add the results
Example:
Binary Conversions:
1. Decimal To Binary
2. Octal to Binary
3. Hexadecimal to Binary
Decimal To Binary Conversions:
• Technique
– Divide by two, keep track of the remainder
– First remainder is bit 0 (LSB, least-significant bit)
– Second remainder is bit 1
– Etc.
9 | P a g e
Octal to Binary:
• Technique
– Convert each octal digit to a 3-bit equivalent binary representation
Example:
10 | P a g e
Hexadecimal to Binary:
• Technique
– Convert each hexadecimal digit to a 4-bit equivalent binary representation
Example:
11 | P a g e
Octal conversions:
1.Decimal to Octal
2.Hexadecimal to octal
3.Binary to Octal
Decimal to Octal Conversions:
• Technique
– Divide by 8
– Keep track of the remainder
2.HexaDecimal to Octal:
• Technique
– Step:1 covert hexadecimal value into binary
12 | P a g e
– Step2: take 3 digits from right to left
3.Binary to Octal Conversion:
• Technique
– Group bits in threes, starting on right
– Convert to octal digits
–
13 | P a g e
HexaDecimal Conversions:
1. Decimal Hexadecimal
2. Binary to Hexadecimal
3. Octal to Hexadecimal
Decimal Hexadecimal :
• Technique
– Divide by 16
– Keep track of the remainder
Example:
Binary to Hexadecimal:
14 | P a g e
• Technique
– Group bits in fours, starting on right
– Convert to hexadecimal digits
Octal to Hexadecimal:
15 | P a g e
• Technique
– Step 1:covert octal value into binary
– Step 2: take 4 digits from right to left
3.Computer language:
What is Computer Language?
Generally, we use languages like English, Hindi, etc., to make communication between two
persons. That means when we want to make communication between two persons we need a
language through which persons can express their feelings. Similarly, when we want to make
communication between user and computer or between two or more computers we need a language
through which user can give information to the computer and vice versa. When a user wants to
give any instruction to the computer the user needs a specific language and that language is known
as a computer language.
The user interacts with the computer using programs and that programs are created using computer
programming languages like C, C++, Java, etc.,
Definition:
Computer languages are the languages through which the user can communicate with the
computer by writing program instructions.
Classification of Computer Languages:
16 | P a g e
Low-Level Language (Machine Language):
Low-Level language is the only language which can be understood by the computer. Binary
Language is an example of a low-level language. Low-level language is also known as Machine
Language. The binary language contains only two symbols 1 & 0. All the instructions of binary
language are written in the form of binary numbers 1's & 0's. A computer can directly understand
the binary language. Machine language is also known as the Machine Code.
As the CPU directly understands the binary language instructions, it does not require any
translator. CPU directly starts executing the binary language instructions and takes very less time
to execute the instructions as it does not require any translation. Low-level language is considered
as the First Generation Language (1GL).
Advantages:
• A computer can easily understand the low-level language.
• Low-level language instructions are executed directly without any translation.
• Low-level language instructions require very less time for their execution.
Disadvantages:
• Low-level language instructions are very difficult to use and understand.
• Low-level language instructions are machine-dependent, that means a program written for a
particular machine does not execute on another machine.
• In low-level language, there is more chance for errors and it is very difficult to find errors,
17 | P a g e
debug and modify.
Middle-Level Language (Assembly Language):
Middle-level language is a computer language in which the instructions are created using
symbols such as letters, digits and special characters. Assembly language is an example of
middle-level language. In assembly language, we use predefined words calledmnemonics.
Binary code instructions in low-level language are replaced with mnemonics and operands
in middle-level language. But the computer cannot understand mnemonics, so we use a
translator called Assembler to translate mnemonics into binary language. Assembler is a
translator which takes assembly code as input and produces machine code as output. That
means, the computer cannot understand middle-level language, so it needs to be translated
into a low-level language to make it understandable by the computer. Assembler is used to
translate middle-level language into low-level language.
Advantages:
• Writing instructions in a middle-level language is easier than writing instructions in a low-
level language.
• Middle-level language is more readable compared to low-level language.
• Easy to understand, find errors and modify.
Disadvantages:
• Middle-level language is specific to a particular machine architecture, that means it is
machine-dependent.
• Middle-level language needs to be translated into low-level language.
• Middle-level language executes slower compared to low-level language.
High-Level Language:
A high-level language is a computer language which can be understood by the users. The high-
level language is very similar to human languages and has a set of grammar rules that are used
18 | P a g e
to make instructions more easily. Every high-level language has a set of predefined words
known as Keywords and a set of rules known as Syntax to create instructions. The high-level
language is easier to understand for the users but the computer can not understand it. High-
level language needs to be converted into the low-level language to make it understandable by
the computer. We use Compiler or interpreter to convert high-level language to low-level
language.
Languages like COBOL, FORTRAN, BASIC, C, C++, JAVA, etc., are examples of high-level
languages. All these programming languages use human-understandable language like English
to write program instructions. These instructions are converted to low-level language by the
compiler so that it can be understood by the computer.
Advantages:
• Writing instructions in a high-level language is easier.
• A high-level language is more readable and understandable.
• The programs created using high-level language runs on different machines with little
change or no change.
• Easy to understand, create programs, find errors and modify.
Disadvantages:
• High-level language needs to be translated into low-level language.
• High-level language executes slower compared to middle and low-level languages.
• Understanding Computer Languages
• The following figure provides a few key points related to computer languages.
4.Background and Characteristics Of C:
C is a structured programming language. It is also known as function orientated programming
language. C programming language was developed in the year of 1972 by Dennis Ritchie at Bell
Laboratories in the USA (AT & T).
In the year of 1968, research was started by Dennis Ritchie on programming languages like BCPL,
19 | P a g e
CPL. The main aim of his research was to develop a new language to create an OS called UNIX.
After four years of research, a new programming language was created with solutions for
drawbacks in languages like BCPL & CPL. In the year of 1972, the new language was introduced
with the name “Traditional C”.
The name 'c' was selected from the sequence of previous language ‘B’ (BCPL) because most of the
features of 'c' were derived from BCPL (B language).
The first outcome of the c language was the UNIX operating system. The initial UNIX OS was
completely developed using 'c' programming language.
The founder of the ‘C’ language, Dennis Ritchie is known as “Father of C” and also “Father of
UNIX”.
20 | P a g e
Characteristics of C:
1)Simple and Clear----C has richest collection of data types(int,float,char), operators(symbolic
representation) and inbuilt functions.
2)Srtuctured Approach----C provide the fundamental control flow constructions required for
well structured program like statement grouping, decision making(if-else),switch-case, break
etc.
3)Portable----C has the characteristics of portability .Portable means computer independent.
The programs made in C on one computer can be run on different computers by not changing
anything.
4)Case Sensitive----Case Sensitive means that almost everything in C program is written in
small case.
5)Easily Available and Quick----The C compiler are very easily available and require very less
disk space .
TURBO C is the compiler which is very easy to load in your computer.
6)Modular----Modular means the programs can be easily divided into small modules with the
use of functions.
7)Easy Error detection: Whenever we compile the program after typing it in the editor, the
errors are immediately displayed on the screen pointing to the line numbers where they are
actually coming.
8)Availability of recursive function----This help us to reduce the writing of definition of
functions by calling same function again and again reduce the lines of codes as well and are
easy to remember.
21 | P a g e
5.Algorithm and Flowchart:
An algorithm is a procedure or step-by-step instruction for solving a problem. They form the
foundation of writing a program.
Characteristics of algorithm:
Flowchart:
Flowchart is a diagrammatic representation of sequence of logical steps of a program. Flowcharts
use simple geometric shapes to depict processes and arrows to show relationships and process/data
flow.
Flowchart Symbols:
22 | P a g e
Example:
Write algorithm and flowchart to calculate average of 3 numbers
Algorithm:
Step 1:start
Step 2:Read Num1,num2
Step 3: average=(num1+num2)/2
Step 4: Print Average
Step 5:Stop
Flowchart:
23 | P a g e
6.Psuedo code:
Pseudo code is a term which is often used in programming and algorithm based fields. It is a
methodology that allows the programmer to represent the implementation of an algorithm.
Example:
Adding two numbers
24 | P a g e
7.Structute of C:
Documentation Section
This section consists of comment lines which include the name of programmer, the author and
other details like time and date of writing the program. Documentation section helps anyone to get
an overview of the program.
Link Section
The link section consists of the header files of the functions that are used in the program. It
provides instructions to the compiler to link functions from the system library.
Definition Section
All the symbolic constants are written in definition section. Macros are known as symbolic
constants.
25 | P a g e
Global Declaration Section
The global variables that can be used anywhere in the program are declared in global declaration
section. This section also declares the user defined functions.
main() Function Section
It is necessary have one main() function section in every C program. This section contains two
parts, declaration and executable part. The declaration part declares all the variables that are used
in executable part. These two parts must be written in between the opening and closing braces.
Each statement in the declaration and executable part must end with a semicolon (;). The execution
of program starts at opening braces and ends at closing braces.
Subprogram Section/user defined section
The subprogram section contains all the user defined functions that are used to perform a specific
task. These user defined functions are called in the main() function.
8.Input/output Statements in C:
C Input Functions:
C programming language provides built-in functions to perform input operations. The input
operations are used to read user values (input) from the keyboard. The c programming language
provides the following built-in input functions.
1.scanf()
2.getch()
3.getchar()
4.gets()
scanf() function:
The scanf() function is used to read multiple data values of different data types from the keyboard.
The scanf() function is built-in function defined in a header file called "stdio.h". When we want to
use scanf() function in our program, we need to include the respective header file (stdio.h)
using #include statement. The scanf() function has the following syntax...
26 | P a g e
Syntax:
scanf("format strings",&variableNames);
Example Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
printf("nEnter any integer value: ");
scanf("%d",&i);
printf("nYou have entered %d number",i);
}
Output Function:
programming language provides built-in functions to perform output operation. The output
operations are used to display data on user screen (output screen) or printer or any file. The c
programming language provides the following built-in output functions...
1. printf()
2. putchar()
3. puts()
printf() function:
The printf() function is used to print string or data values or a combination of string and data values
on the output screen (User screen). The printf() function is built-in function defined in a header file
called "stdio.h". When we want to use printf() function in our program we need to include the
respective header file (stdio.h) using the #include statement. The printf() function has the following
syntax...
27 | P a g e
Syntax:
printf("message to be display!!!");
Example Program
#include<stdio.h>
#include<conio.h>
void main()
{
printf("Hello! Welcome to btechsmartclass!!!");
}
Output:
In the above example program, we used the printf() function to print a string on to the output
screen.
The printf() function is also used to display data values. When we want to display data values we
use format string of the data value to be displayed.
Syntax:
printf("format string",variableName);
Example Program
#include<stdio.h>
#include<conio.h>
void main()
28 | P a g e
{
int i = 10;
float x = 5.5;
printf("%d %f",i, x);
}
Output:
9. Compiling and executing C programs.
29 | P a g e

More Related Content

Similar to PSPC--UNIT-1.pdf

INTRODUCTION TO INFORMATION TECHNOLOGY SARASWATHI RAMALINGAM
INTRODUCTION TO INFORMATION TECHNOLOGY SARASWATHI RAMALINGAMINTRODUCTION TO INFORMATION TECHNOLOGY SARASWATHI RAMALINGAM
INTRODUCTION TO INFORMATION TECHNOLOGY SARASWATHI RAMALINGAMSaraswathiRamalingam
 
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...Abhishekn84
 
Chapter 1 Introduction to computer components
Chapter 1 Introduction to computer componentsChapter 1 Introduction to computer components
Chapter 1 Introduction to computer componentsBoonsaaMulataa
 
Computer Programming By Prof.(Dr.) Anand K. Tripathi ,Mrs Monika Tripathi
Computer Programming By Prof.(Dr.) Anand K. Tripathi ,Mrs Monika TripathiComputer Programming By Prof.(Dr.) Anand K. Tripathi ,Mrs Monika Tripathi
Computer Programming By Prof.(Dr.) Anand K. Tripathi ,Mrs Monika TripathiProf. (Dr.) Anand K. Tripathi
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptxPmarkNorcio
 
C++ programming languages lectures
C++ programming languages lectures C++ programming languages lectures
C++ programming languages lectures jabirMemon
 
Programming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages ConceptsProgramming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages Conceptsimtiazalijoono
 
Basic terms used in microprocessor
Basic terms used in microprocessorBasic terms used in microprocessor
Basic terms used in microprocessorRamaPrabha24
 
PPS UNIT 1- R18.docx
PPS UNIT 1- R18.docxPPS UNIT 1- R18.docx
PPS UNIT 1- R18.docxUzma1102
 
Computer and Programming
Computer and Programming Computer and Programming
Computer and Programming Mahsa Ch
 
Computer program and programming language
Computer program and programming languageComputer program and programming language
Computer program and programming languageNeeladriBijayMisra
 
4 coding from algorithms
4 coding from algorithms4 coding from algorithms
4 coding from algorithmshccit
 
Ch0 computer systems overview
Ch0 computer systems overviewCh0 computer systems overview
Ch0 computer systems overviewAboubakarIbrahima
 

Similar to PSPC--UNIT-1.pdf (20)

INTRODUCTION TO INFORMATION TECHNOLOGY SARASWATHI RAMALINGAM
INTRODUCTION TO INFORMATION TECHNOLOGY SARASWATHI RAMALINGAMINTRODUCTION TO INFORMATION TECHNOLOGY SARASWATHI RAMALINGAM
INTRODUCTION TO INFORMATION TECHNOLOGY SARASWATHI RAMALINGAM
 
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
 
Lecture 2 - Introductory Concepts
Lecture 2 - Introductory ConceptsLecture 2 - Introductory Concepts
Lecture 2 - Introductory Concepts
 
Computer programming
Computer programmingComputer programming
Computer programming
 
c programming 1-1.pptx
c programming 1-1.pptxc programming 1-1.pptx
c programming 1-1.pptx
 
intro.ppt
intro.pptintro.ppt
intro.ppt
 
Chapter 1 Introduction to computer components
Chapter 1 Introduction to computer componentsChapter 1 Introduction to computer components
Chapter 1 Introduction to computer components
 
Computer Programming By Prof.(Dr.) Anand K. Tripathi ,Mrs Monika Tripathi
Computer Programming By Prof.(Dr.) Anand K. Tripathi ,Mrs Monika TripathiComputer Programming By Prof.(Dr.) Anand K. Tripathi ,Mrs Monika Tripathi
Computer Programming By Prof.(Dr.) Anand K. Tripathi ,Mrs Monika Tripathi
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
 
C++ programming languages lectures
C++ programming languages lectures C++ programming languages lectures
C++ programming languages lectures
 
Programming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages ConceptsProgramming Fundamentals and Programming Languages Concepts
Programming Fundamentals and Programming Languages Concepts
 
Basic terms used in microprocessor
Basic terms used in microprocessorBasic terms used in microprocessor
Basic terms used in microprocessor
 
PPS UNIT 1- R18.docx
PPS UNIT 1- R18.docxPPS UNIT 1- R18.docx
PPS UNIT 1- R18.docx
 
Computer and Programming
Computer and Programming Computer and Programming
Computer and Programming
 
Computer program and programming language
Computer program and programming languageComputer program and programming language
Computer program and programming language
 
4 coding from algorithms
4 coding from algorithms4 coding from algorithms
4 coding from algorithms
 
6272 cnote
6272 cnote6272 cnote
6272 cnote
 
C progrmming
C progrmmingC progrmming
C progrmming
 
Ch0 computer systems overview
Ch0 computer systems overviewCh0 computer systems overview
Ch0 computer systems overview
 
Chapter1.ppt
Chapter1.pptChapter1.ppt
Chapter1.ppt
 

Recently uploaded

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 

Recently uploaded (20)

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 

PSPC--UNIT-1.pdf

  • 1. 1 | P a g e S.NO TOPIC PAGE NUMBER 1. Computer systems 2 2. computer number systems 6 3. Computer Languages 15 4. Background and characteristics of C 18 5. Algorithms & Flowchart 21 6. pseudo code 23 7. Structure of a C Program 24 8. Input/output Statements in C 25 9. Compiling and executing C programs. 28 UNIT-1 Introduction to computers: Computer systems, computer Languages, computer number systems. Introduction to C programming: Background and characteristics of C, Flow Charts, algorithms and pseudo code. Structure of a C Program, Input/output Statements in C, writing C programs, compiling and executing C programs.
  • 2. 2 | P a g e 1. Computer systems: What is a Computer? The computer is an electronic device which operates under the control of instructions stored in its memory. A computer can take data from the user through input devices (Input), process the user given data (Processing), produces the result to the user through output devices (Output)and stores data (Information) for future use. A Computer can be defined as follows... The Computer is an electronic device which operates under the control of instructions stored in its memory and it takes the data from the user, a process that data gives the result and stores the result for future use. Every computer mainly consists of three things and those are... 1. Hardware 2. Software 3. User History of computers:
  • 3. 3 | P a g e The computer hardware components are as follows... 1. Input Devices - These are the parts through which a user can give the data to the computer. 2. Output Devices - These are the physical components of a computer through which the computer gives the result to the user. 3. Storage Devices - These are the physical components of a computer in which the data can be stored. 4. Devices Drives - Using drives, user can read and write data on to the storage devices like CD, floppy, etc., 5. Cables - Various cables (Wires) are used to make connections in a computer 6. Other Devices - Other than the above hardware components, a computer also contains components like Motherboard, CPU (Processor), SMPS, Fans, etc., Input Devices Computer input devices are the physical components of the computer which are used to give the data given by the user to the computer. Using input devices the user can give the data to the computer. Example Output Devices: Computer output devices are the physical components of the computer which are used to give the computer result to the User. Using output devices, the user can see the computer-generated result. Example Storage Devices: Computer storage devices are the physical components of the computer which are used to store data internally or externally. Example
  • 4. 4 | P a g e Device Drives: Computer Device drives are the physical components of the computer which are used to read and write data on the storage devices. Example Computer Cables: In a Computer, various cables are used to make connections among the various hardware components of the computer. Example Other Devices: Other devices of the computer are shown below... CPU (Processor)
  • 5. 5 | P a g e SMPS CPU Fan (Heat Sink) Motherboard
  • 6. 6 | P a g e 2. Computer number systems: Electronic and Digital systems may use a variety of different number systems, (e.g. Decimal, Hexadecimal, Octal, Binary). Conversions: Decimal Conversions: 1. Binary to Decimal 2. Octal to Decimal 3. Hexadecimal to Decimal Binary To Decimal Conversion:
  • 7. 7 | P a g e • • Technique – Multiply each bit by 2n , where n is the “weight” of the bit – The weight is the position of the bit, starting from 0 on the right – Add the results Example: Octal To Decimal Conversion: • Technique – Multiply each bit by 8n , where n is the “weight” of the bit – The weight is the position of the bit, starting from 0 on the right – Add the results Example: HexaDecimal to decimal:
  • 8. 8 | P a g e • Technique – Multiply each bit by 16n , where n is the “weight” of the bit – The weight is the position of the bit, starting from 0 on the right -- Add the results Example: Binary Conversions: 1. Decimal To Binary 2. Octal to Binary 3. Hexadecimal to Binary Decimal To Binary Conversions: • Technique – Divide by two, keep track of the remainder – First remainder is bit 0 (LSB, least-significant bit) – Second remainder is bit 1 – Etc.
  • 9. 9 | P a g e Octal to Binary: • Technique – Convert each octal digit to a 3-bit equivalent binary representation Example:
  • 10. 10 | P a g e Hexadecimal to Binary: • Technique – Convert each hexadecimal digit to a 4-bit equivalent binary representation Example:
  • 11. 11 | P a g e Octal conversions: 1.Decimal to Octal 2.Hexadecimal to octal 3.Binary to Octal Decimal to Octal Conversions: • Technique – Divide by 8 – Keep track of the remainder 2.HexaDecimal to Octal: • Technique – Step:1 covert hexadecimal value into binary
  • 12. 12 | P a g e – Step2: take 3 digits from right to left 3.Binary to Octal Conversion: • Technique – Group bits in threes, starting on right – Convert to octal digits –
  • 13. 13 | P a g e HexaDecimal Conversions: 1. Decimal Hexadecimal 2. Binary to Hexadecimal 3. Octal to Hexadecimal Decimal Hexadecimal : • Technique – Divide by 16 – Keep track of the remainder Example: Binary to Hexadecimal:
  • 14. 14 | P a g e • Technique – Group bits in fours, starting on right – Convert to hexadecimal digits Octal to Hexadecimal:
  • 15. 15 | P a g e • Technique – Step 1:covert octal value into binary – Step 2: take 4 digits from right to left 3.Computer language: What is Computer Language? Generally, we use languages like English, Hindi, etc., to make communication between two persons. That means when we want to make communication between two persons we need a language through which persons can express their feelings. Similarly, when we want to make communication between user and computer or between two or more computers we need a language through which user can give information to the computer and vice versa. When a user wants to give any instruction to the computer the user needs a specific language and that language is known as a computer language. The user interacts with the computer using programs and that programs are created using computer programming languages like C, C++, Java, etc., Definition: Computer languages are the languages through which the user can communicate with the computer by writing program instructions. Classification of Computer Languages:
  • 16. 16 | P a g e Low-Level Language (Machine Language): Low-Level language is the only language which can be understood by the computer. Binary Language is an example of a low-level language. Low-level language is also known as Machine Language. The binary language contains only two symbols 1 & 0. All the instructions of binary language are written in the form of binary numbers 1's & 0's. A computer can directly understand the binary language. Machine language is also known as the Machine Code. As the CPU directly understands the binary language instructions, it does not require any translator. CPU directly starts executing the binary language instructions and takes very less time to execute the instructions as it does not require any translation. Low-level language is considered as the First Generation Language (1GL). Advantages: • A computer can easily understand the low-level language. • Low-level language instructions are executed directly without any translation. • Low-level language instructions require very less time for their execution. Disadvantages: • Low-level language instructions are very difficult to use and understand. • Low-level language instructions are machine-dependent, that means a program written for a particular machine does not execute on another machine. • In low-level language, there is more chance for errors and it is very difficult to find errors,
  • 17. 17 | P a g e debug and modify. Middle-Level Language (Assembly Language): Middle-level language is a computer language in which the instructions are created using symbols such as letters, digits and special characters. Assembly language is an example of middle-level language. In assembly language, we use predefined words calledmnemonics. Binary code instructions in low-level language are replaced with mnemonics and operands in middle-level language. But the computer cannot understand mnemonics, so we use a translator called Assembler to translate mnemonics into binary language. Assembler is a translator which takes assembly code as input and produces machine code as output. That means, the computer cannot understand middle-level language, so it needs to be translated into a low-level language to make it understandable by the computer. Assembler is used to translate middle-level language into low-level language. Advantages: • Writing instructions in a middle-level language is easier than writing instructions in a low- level language. • Middle-level language is more readable compared to low-level language. • Easy to understand, find errors and modify. Disadvantages: • Middle-level language is specific to a particular machine architecture, that means it is machine-dependent. • Middle-level language needs to be translated into low-level language. • Middle-level language executes slower compared to low-level language. High-Level Language: A high-level language is a computer language which can be understood by the users. The high- level language is very similar to human languages and has a set of grammar rules that are used
  • 18. 18 | P a g e to make instructions more easily. Every high-level language has a set of predefined words known as Keywords and a set of rules known as Syntax to create instructions. The high-level language is easier to understand for the users but the computer can not understand it. High- level language needs to be converted into the low-level language to make it understandable by the computer. We use Compiler or interpreter to convert high-level language to low-level language. Languages like COBOL, FORTRAN, BASIC, C, C++, JAVA, etc., are examples of high-level languages. All these programming languages use human-understandable language like English to write program instructions. These instructions are converted to low-level language by the compiler so that it can be understood by the computer. Advantages: • Writing instructions in a high-level language is easier. • A high-level language is more readable and understandable. • The programs created using high-level language runs on different machines with little change or no change. • Easy to understand, create programs, find errors and modify. Disadvantages: • High-level language needs to be translated into low-level language. • High-level language executes slower compared to middle and low-level languages. • Understanding Computer Languages • The following figure provides a few key points related to computer languages. 4.Background and Characteristics Of C: C is a structured programming language. It is also known as function orientated programming language. C programming language was developed in the year of 1972 by Dennis Ritchie at Bell Laboratories in the USA (AT & T). In the year of 1968, research was started by Dennis Ritchie on programming languages like BCPL,
  • 19. 19 | P a g e CPL. The main aim of his research was to develop a new language to create an OS called UNIX. After four years of research, a new programming language was created with solutions for drawbacks in languages like BCPL & CPL. In the year of 1972, the new language was introduced with the name “Traditional C”. The name 'c' was selected from the sequence of previous language ‘B’ (BCPL) because most of the features of 'c' were derived from BCPL (B language). The first outcome of the c language was the UNIX operating system. The initial UNIX OS was completely developed using 'c' programming language. The founder of the ‘C’ language, Dennis Ritchie is known as “Father of C” and also “Father of UNIX”.
  • 20. 20 | P a g e Characteristics of C: 1)Simple and Clear----C has richest collection of data types(int,float,char), operators(symbolic representation) and inbuilt functions. 2)Srtuctured Approach----C provide the fundamental control flow constructions required for well structured program like statement grouping, decision making(if-else),switch-case, break etc. 3)Portable----C has the characteristics of portability .Portable means computer independent. The programs made in C on one computer can be run on different computers by not changing anything. 4)Case Sensitive----Case Sensitive means that almost everything in C program is written in small case. 5)Easily Available and Quick----The C compiler are very easily available and require very less disk space . TURBO C is the compiler which is very easy to load in your computer. 6)Modular----Modular means the programs can be easily divided into small modules with the use of functions. 7)Easy Error detection: Whenever we compile the program after typing it in the editor, the errors are immediately displayed on the screen pointing to the line numbers where they are actually coming. 8)Availability of recursive function----This help us to reduce the writing of definition of functions by calling same function again and again reduce the lines of codes as well and are easy to remember.
  • 21. 21 | P a g e 5.Algorithm and Flowchart: An algorithm is a procedure or step-by-step instruction for solving a problem. They form the foundation of writing a program. Characteristics of algorithm: Flowchart: Flowchart is a diagrammatic representation of sequence of logical steps of a program. Flowcharts use simple geometric shapes to depict processes and arrows to show relationships and process/data flow. Flowchart Symbols:
  • 22. 22 | P a g e Example: Write algorithm and flowchart to calculate average of 3 numbers Algorithm: Step 1:start Step 2:Read Num1,num2 Step 3: average=(num1+num2)/2 Step 4: Print Average Step 5:Stop Flowchart:
  • 23. 23 | P a g e 6.Psuedo code: Pseudo code is a term which is often used in programming and algorithm based fields. It is a methodology that allows the programmer to represent the implementation of an algorithm. Example: Adding two numbers
  • 24. 24 | P a g e 7.Structute of C: Documentation Section This section consists of comment lines which include the name of programmer, the author and other details like time and date of writing the program. Documentation section helps anyone to get an overview of the program. Link Section The link section consists of the header files of the functions that are used in the program. It provides instructions to the compiler to link functions from the system library. Definition Section All the symbolic constants are written in definition section. Macros are known as symbolic constants.
  • 25. 25 | P a g e Global Declaration Section The global variables that can be used anywhere in the program are declared in global declaration section. This section also declares the user defined functions. main() Function Section It is necessary have one main() function section in every C program. This section contains two parts, declaration and executable part. The declaration part declares all the variables that are used in executable part. These two parts must be written in between the opening and closing braces. Each statement in the declaration and executable part must end with a semicolon (;). The execution of program starts at opening braces and ends at closing braces. Subprogram Section/user defined section The subprogram section contains all the user defined functions that are used to perform a specific task. These user defined functions are called in the main() function. 8.Input/output Statements in C: C Input Functions: C programming language provides built-in functions to perform input operations. The input operations are used to read user values (input) from the keyboard. The c programming language provides the following built-in input functions. 1.scanf() 2.getch() 3.getchar() 4.gets() scanf() function: The scanf() function is used to read multiple data values of different data types from the keyboard. The scanf() function is built-in function defined in a header file called "stdio.h". When we want to use scanf() function in our program, we need to include the respective header file (stdio.h) using #include statement. The scanf() function has the following syntax...
  • 26. 26 | P a g e Syntax: scanf("format strings",&variableNames); Example Program: #include<stdio.h> #include<conio.h> void main() { int i; printf("nEnter any integer value: "); scanf("%d",&i); printf("nYou have entered %d number",i); } Output Function: programming language provides built-in functions to perform output operation. The output operations are used to display data on user screen (output screen) or printer or any file. The c programming language provides the following built-in output functions... 1. printf() 2. putchar() 3. puts() printf() function: The printf() function is used to print string or data values or a combination of string and data values on the output screen (User screen). The printf() function is built-in function defined in a header file called "stdio.h". When we want to use printf() function in our program we need to include the respective header file (stdio.h) using the #include statement. The printf() function has the following syntax...
  • 27. 27 | P a g e Syntax: printf("message to be display!!!"); Example Program #include<stdio.h> #include<conio.h> void main() { printf("Hello! Welcome to btechsmartclass!!!"); } Output: In the above example program, we used the printf() function to print a string on to the output screen. The printf() function is also used to display data values. When we want to display data values we use format string of the data value to be displayed. Syntax: printf("format string",variableName); Example Program #include<stdio.h> #include<conio.h> void main()
  • 28. 28 | P a g e { int i = 10; float x = 5.5; printf("%d %f",i, x); } Output: 9. Compiling and executing C programs.
  • 29. 29 | P a g e