SlideShare une entreprise Scribd logo
1  sur  29
C PROGRAMMING LANGUAGE
INTRODUCTION TO C
• It is a structured programming language used to develop operating
system, business system, word processing, database system e.t.c
• Developed by Dennis Ritchie at the Bell Laboratories in 1972 to develop
the UNIX operating system.
• At the time, Bell Labs had a programming language named B — B for
Bell. The next language they created was C — one up on B.
• C is the offspring of both the B programming language and a
language named BCPL, which stood for Basic Combined Programming
Language.
• It is modular language. C code can be written in routines called
functions. These functions can be reused in other applications or
programs.
• It is case sensitive language.
C LANGUAGE PIECES PARTS
1. #include is known as a preprocessor directive. It tells
the compiler to “include” text from another file,
stuffing it right into source code. Doing this avoids lots
of little, annoying errors.
2. <stdio.h> is a filename surrounded by angle brackets.
The whole statement #include <stdio.h> tells the
compiler to take text from the file STDIO.H and stick it
into source code before the source code is compiled.
The STDIO.H file itself contains information about the
Standard Input/output functions required by most C
programs. The H means “header.”
3. The int identifies the function main as an integer
function, meaning that main() must return an
integer value when it’s done. The function main,
which also identifies the first and primary function
inside the program.
4. Two empty parentheses follow the function name.
5. All functions in C have their contents encased by
curly braces.
6. printf() job is to display information(output) on the
screen. The added f means “formatted,”.
7. printf() has a set of parentheses, which consists of text, or a
“string” of characters. Everything between the double quote
characters (“) is part of printf’s text string.
8. ‘n’ called a newline in C are called wildcard characters.
9. The printf line, or statement, ends with a semicolon. The
semicolon tells the C compiler where one statement ends and
another begins. Note that all statements require semicolons in
C, even if only one statement is in a program or function.
10. The return command sends the value 0 (zero) back to the
operating system when the main() function is done. Returning a
value is required as part of the main() function. This statement
ends in a semicolon.
QUIZ!
1. The core function in every C language program is called
A. numero_uno().
B. main().
C. primus().
D. core().
2. Functions require parentheses because
A. They talk in whispers.
B. The parentheses keep the function warm.
C. The parentheses hold various things required by or belonging to
the function.
D. None
C PROGRAMMING LANGUAGE
SESSION 2
VARIABLES
• A variable is a named data storage location on computers memory. By
using variable name on our program we are, in effect referring to the
data stored there.
• For many compilers, a variable name can be up to 31 character long. But
it can be actually longer than that)
• Rules for naming a variable:-
• The name can contain letters, digit and the underscore character(_).
• The first character of the name must be a letter. The underscore is also
legal but it’s not recommended.
• Case matters.
• C keywords cannot be used as a variable name.
• It should not contain any other special character than underscore(_).
• A variable name mustn’t have any embedded space.
• Declaring a variable:-
• A variable declaration tells the compiler the name and the type of a variable and
optionally initializes the variable to a specific value.
• A variable declaration has following form:-
Data_type_name variable name;
Eg: int roll,num;
float percentage;
• Data Type:
• The data type defines the values that needs to be stored in a program.
• C supports mainly two type of data types:
1. Primary data types
2. Derived data types
3. User defined data type
PRIMARY DATA TYPE
Data type Data sub_type Bytes Format Range
Character
Signed 1 %c -128 to 127
Unsigned 1 %c 0 to 255
Numeric
Sort Signed int 2 %d -32768 to 32767
Sort Unsigned int 2 %d 0 to 65535
Long Signed int 4 %1d -2147483648 to
2147483647
Long Unsigned int 4 %1d 0 to 4294967295
Float 4 %f 3.4E-38 to 3.4E+38
Double 8 %1f 3.7E-308 to
3.4E+308
Long double 10 %1f 3.4E-4932 to
3.4E + 4932
• Derived Data Types:
• Functions, arrays and pointers are derived data type.
• User Defined Data Type:
• The user defined datatype identifier can later be used to
declare variables.
• The user defined data types are:
• Structure
• Union
• Enumeration
CONSTANT
• A constant is the fixed value that do not change during the execution
of the program.
• C supports four constants:-
• Character
• String
• Integer
• floating-point constants.
• The numeric constants(integer and floating-point) must adhere
following rules:-
1. Commas and blank spaces cannot be included within the
constants.
2. The constant can be preceded by a minus(-) sign if desired.
3. The value of constant cannot exceed specified minimum and
maximum bounds
QUIZ
1. Which of the following variable name is not a valid variable name?
a) Annual_profit
b) _2009_tax
c) Saving#account
d) Year2x5_abc
2. How many bytes of memory does a double data type take ?
a) -32768 to 32767
b) 0 to 255
c) 4
d) 8
1. Which of the valid format specifier for string type value?
a) %d
b) %c
c) %st
d) %s
2. What is the range of short signed Integer?
a) -32768 to 32767
b) 0 to 255
c) 0 to 65535
d) 3.7E-308 to 3.4E+308
C PROGRAMMING LANGUAGE
SESSION 3
OPERATOR
• Operator is a symbol which helps the user to command the computer
to do certain mathematical or logical manipulation.
• Types of operator
• Arithmetic Operator
• Assignment Operator
• Unary Operator
• Relational Operator
• Logical Operator
• Ternary operator
• Comma Operator
• Bitwise Operator
• Size of Operator
1) Arithmetic Operator
Basic mathematical operation.
Operator Symbol
Addition +
Subtraction -
Multiplication *
Division /
Modulus %
(Returns Reminder)
2) Assignment Operator
Is used to assign Values.
Some of them are =,+=,-=,*=,/=,%=
3. Unary Operator:
• It is so called because they take a single operand. It acts upon
single operand to be increased or decreased by one.
• Operator Symbol action Example
Increment ++ Increments the operand by one x++,++x
Decrement -- Decrements the operand by one x--,--x
• They differ in which mode they are used.
• When used in prefix mode, the increment and decrement
operators modify their operand before it’s used.
• When Used in postfix mode, the increment and decrement
operators modify their operand after it’s use.
4. Relational Operator:-
It is used to compare expressions. An expression containing a relational
operator evaluates to either true or false.
Operator Symbol
Equal ==
Greater than >
Less than <
Grater than or equal to >=
Less than or equal to <=
Not Equal !=
5. Logical Operator:-
It let’s us to combine two or more relational expression into a single expression
that evaluates to either true or false.
Operator Symbol
AND &&
OR ||
NOT !
6. Ternary Operator:-
It is used to check certain relational expression and execute the true statement if
the condition is true and display if the condition is false.
Syntax:
[condition] ? [true statement]:[false statement]
Example:
a>b ? printf (“a is greater”) : printf (“b is greater”);
7. Bitwise Operator:-
These operators are used for having bit level computations of different values.
Operator Meaning
& bitwise AND
| bitwise OR
^ bitwise exclusive OR
>> shift cells right
>> shift cells left
- one’s complement
6. Size of () Operator:-
Returns the number of bytes occupied in the memory
Syntax:
sizeof(datatype/variable);
Example:
sizeof(int);
ESCAPE SEQUENCE
• These are characters not printed when used but provide various
functions. These are always started with a backslash ‘’. Commonly
Used are:-
• Constant Meaning
‘a’ Audible Alert
‘b’ backspace
‘f’ Form feed
‘n’ New Line
‘r’ Carriage Return
‘t’ Horizontal Tab
‘V’ Vertical Tab
‘’’ Single quote
‘”’ Double quote
‘?’ Question mark
‘’ Back slash
‘0’ Null
HEADER FILES
• Header File contains definition of functions and variables which
can be incorporated into any c program by using the preprocessor
#include statement. All header files have the extension .h.
• Some commonly used Header files:
• Stdio.h : It contains the standard input and output functions like
printf(), scanf(),gets(),puts() etc.
• Conio.h : It contains some of the functions like getch(), clrscr()
etc.
• Math.h : It contains the mathematical functions like strlen(),
strcpy(), strcmp(), strrev() etc.
• Ctype.h : it contains some validating functions like isdigit(),
isalnum(), isalpha() and some converting functions like
toupper(), tolower() etc.
SEQUENCE
Programming I
• WAP to calculate the area and circumference of a circle . Where radius of a
circle is input by user and define pi as constant.
• WAP to read principle, time and rate to calculate the simple interest and total
amount .
• WAP to convert temperature in Fahrenheit into centigrade and vice versa.
• WAP to ask cost of pen in Paisa. Convert it into nearest rupees and paisa.
• WAP to enter distance between two cities in KM and convert it into meter,
centimeter, inch and feet.
• WAP to enter any 4 digit number and find the sum of the first and last digit of the
number.[e.g. Any four digit number =4567, sum =4+7].
• WAP to supply length and breadth of a rectangle. Find out area and perimeter.
• WAP to find total and percentage of the students whose marks are as follows:
• WAP to enter 4 digit number and find the sum of them.[e.g.
1234=1+2+3+4=10].
• WAP to interchange the contents of x and y after entering the value of x and
y
• WAP to read the radius of the sphere and find the volume and area of it.
Subjects Marks
English 65
Nepali 75
Computer Science 70
Math 80
Account 60
• WAP to find the area of triangle after reading the value of base and
height.
• WAP to find the compound interest. The value principle, time and
interest rate is given by user.
• WAP to find the area of a triangle, if the length of the side of a triangle
are denoted by a, b, c then area of triangle id given by
Area= 𝒔 𝒔 − 𝒂 𝒔 − 𝒃 𝒔 − 𝒄 𝐰𝐡𝐞𝐫𝐞 𝒔 =
(𝒂+𝒃+𝒄)
𝟐
.
• Basic salary of Sabin is input through keyboard. His medical
allowance is 10% of the basic salary and provident fund is 10% of the
basic salary. WAP to find his net salary.
• WAP to solve the quadratic equation a𝒙 𝟐
+ b𝒙 + 𝒄 = 𝟎 , 𝒘𝒉𝒆𝒓𝒆
x=
−𝒃±𝒃 𝟐−𝟒𝒂𝒄
𝟐𝒂
C programming language

Contenu connexe

Tendances

Chapter3
Chapter3Chapter3
Chapter3Kamran
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointJavaTpoint.Com
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programmingMalikaJoya
 
Hands-on Introduction to the C Programming Language
Hands-on Introduction to the C Programming LanguageHands-on Introduction to the C Programming Language
Hands-on Introduction to the C Programming LanguageVincenzo De Florio
 
Sachin kumar ppt on programming in c
Sachin kumar ppt on programming in cSachin kumar ppt on programming in c
Sachin kumar ppt on programming in cSachin Kumar
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Functionimtiazalijoono
 
Features of c language 1
Features of c language 1Features of c language 1
Features of c language 1srmohan06
 
Programming in C Basics
Programming in C BasicsProgramming in C Basics
Programming in C BasicsBharat Kalia
 
Brief introduction to the c programming language
Brief introduction to the c programming languageBrief introduction to the c programming language
Brief introduction to the c programming languageKumar Gaurav
 
OpenGurukul : Language : C Programming
OpenGurukul : Language : C ProgrammingOpenGurukul : Language : C Programming
OpenGurukul : Language : C ProgrammingOpen Gurukul
 
Introduction to C Programming - I
Introduction to C Programming - I Introduction to C Programming - I
Introduction to C Programming - I vampugani
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programminggajendra singh
 

Tendances (20)

Chapter3
Chapter3Chapter3
Chapter3
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpoint
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
C language
C languageC language
C language
 
Hands-on Introduction to the C Programming Language
Hands-on Introduction to the C Programming LanguageHands-on Introduction to the C Programming Language
Hands-on Introduction to the C Programming Language
 
Sachin kumar ppt on programming in c
Sachin kumar ppt on programming in cSachin kumar ppt on programming in c
Sachin kumar ppt on programming in c
 
# And ## operators in c
# And ## operators in c# And ## operators in c
# And ## operators in c
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Function
 
C_Programming_Notes_ICE
C_Programming_Notes_ICEC_Programming_Notes_ICE
C_Programming_Notes_ICE
 
Basic c
Basic cBasic c
Basic c
 
Features of c language 1
Features of c language 1Features of c language 1
Features of c language 1
 
Programming in C Basics
Programming in C BasicsProgramming in C Basics
Programming in C Basics
 
Features of c
Features of cFeatures of c
Features of c
 
Brief introduction to the c programming language
Brief introduction to the c programming languageBrief introduction to the c programming language
Brief introduction to the c programming language
 
C programming language
C programming languageC programming language
C programming language
 
OpenGurukul : Language : C Programming
OpenGurukul : Language : C ProgrammingOpenGurukul : Language : C Programming
OpenGurukul : Language : C Programming
 
The smartpath information systems c pro
The smartpath information systems c proThe smartpath information systems c pro
The smartpath information systems c pro
 
Introduction to C Programming - I
Introduction to C Programming - I Introduction to C Programming - I
Introduction to C Programming - I
 
Intro to C++ - language
Intro to C++ - languageIntro to C++ - language
Intro to C++ - language
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 

En vedette (20)

week-20x
week-20xweek-20x
week-20x
 
All important c programby makhan kumbhkar
All important c programby makhan kumbhkarAll important c programby makhan kumbhkar
All important c programby makhan kumbhkar
 
Palindrome number program in c
Palindrome number program in cPalindrome number program in c
Palindrome number program in c
 
Pointers and call by value, reference, address in C
Pointers and call by value, reference, address in CPointers and call by value, reference, address in C
Pointers and call by value, reference, address in C
 
Module 03 File Handling in C
Module 03 File Handling in CModule 03 File Handling in C
Module 03 File Handling in C
 
C lab-programs
C lab-programsC lab-programs
C lab-programs
 
Structure c
Structure cStructure c
Structure c
 
File in c
File in cFile in c
File in c
 
File handling in c
File handling in c File handling in c
File handling in c
 
UNIT 10. Files and file handling in C
UNIT 10. Files and file handling in CUNIT 10. Files and file handling in C
UNIT 10. Files and file handling in C
 
C programs
C programsC programs
C programs
 
C Programming
C ProgrammingC Programming
C Programming
 
File handling in c
File handling in cFile handling in c
File handling in c
 
Structure in c
Structure in cStructure in c
Structure in c
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Array in C
Array in CArray in C
Array in C
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
Function in C program
Function in C programFunction in C program
Function in C program
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
CSS ppt
CSS pptCSS ppt
CSS ppt
 

Similaire à C programming language

Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxFundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxVigneshkumar Ponnusamy
 
M.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C LanguageM.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C LanguageDr.Florence Dayana
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 FocJAYA
 
introductory concepts
introductory conceptsintroductory concepts
introductory conceptsWalepak Ubi
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxLikhil181
 
Basic Information About C language PDF
Basic Information About C language PDFBasic Information About C language PDF
Basic Information About C language PDFSuraj Das
 
C programming tutorial for Beginner
C programming tutorial for BeginnerC programming tutorial for Beginner
C programming tutorial for Beginnersophoeutsen2
 
the refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxthe refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxAnkitaVerma776806
 
CSE 1201: Structured Programming Language
CSE 1201: Structured Programming LanguageCSE 1201: Structured Programming Language
CSE 1201: Structured Programming LanguageZubayer Farazi
 
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit DubeyMCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubeykiranrajat
 

Similaire à C programming language (20)

C programming
C programmingC programming
C programming
 
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxFundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptx
 
C material
C materialC material
C material
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
#Code2 create c++ for beginners
#Code2 create  c++ for beginners #Code2 create  c++ for beginners
#Code2 create c++ for beginners
 
M.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C LanguageM.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C Language
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
 
introductory concepts
introductory conceptsintroductory concepts
introductory concepts
 
C notes
C notesC notes
C notes
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx
 
Basic Information About C language PDF
Basic Information About C language PDFBasic Information About C language PDF
Basic Information About C language PDF
 
C language
C language C language
C language
 
CProgrammingTutorial
CProgrammingTutorialCProgrammingTutorial
CProgrammingTutorial
 
Introduction%20C.pptx
Introduction%20C.pptxIntroduction%20C.pptx
Introduction%20C.pptx
 
c-programming
c-programmingc-programming
c-programming
 
C programming tutorial for Beginner
C programming tutorial for BeginnerC programming tutorial for Beginner
C programming tutorial for Beginner
 
the refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxthe refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptx
 
CSE 1201: Structured Programming Language
CSE 1201: Structured Programming LanguageCSE 1201: Structured Programming Language
CSE 1201: Structured Programming Language
 
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit DubeyMCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
 
Introduction to C
Introduction to CIntroduction to C
Introduction to C
 

Dernier

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
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
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
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
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
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
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
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
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 

Dernier (20)

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
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
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
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
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
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
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
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...
 
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
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 

C programming language

  • 2. INTRODUCTION TO C • It is a structured programming language used to develop operating system, business system, word processing, database system e.t.c • Developed by Dennis Ritchie at the Bell Laboratories in 1972 to develop the UNIX operating system. • At the time, Bell Labs had a programming language named B — B for Bell. The next language they created was C — one up on B. • C is the offspring of both the B programming language and a language named BCPL, which stood for Basic Combined Programming Language. • It is modular language. C code can be written in routines called functions. These functions can be reused in other applications or programs. • It is case sensitive language.
  • 4. 1. #include is known as a preprocessor directive. It tells the compiler to “include” text from another file, stuffing it right into source code. Doing this avoids lots of little, annoying errors. 2. <stdio.h> is a filename surrounded by angle brackets. The whole statement #include <stdio.h> tells the compiler to take text from the file STDIO.H and stick it into source code before the source code is compiled. The STDIO.H file itself contains information about the Standard Input/output functions required by most C programs. The H means “header.”
  • 5. 3. The int identifies the function main as an integer function, meaning that main() must return an integer value when it’s done. The function main, which also identifies the first and primary function inside the program. 4. Two empty parentheses follow the function name. 5. All functions in C have their contents encased by curly braces. 6. printf() job is to display information(output) on the screen. The added f means “formatted,”.
  • 6. 7. printf() has a set of parentheses, which consists of text, or a “string” of characters. Everything between the double quote characters (“) is part of printf’s text string. 8. ‘n’ called a newline in C are called wildcard characters. 9. The printf line, or statement, ends with a semicolon. The semicolon tells the C compiler where one statement ends and another begins. Note that all statements require semicolons in C, even if only one statement is in a program or function. 10. The return command sends the value 0 (zero) back to the operating system when the main() function is done. Returning a value is required as part of the main() function. This statement ends in a semicolon.
  • 7. QUIZ! 1. The core function in every C language program is called A. numero_uno(). B. main(). C. primus(). D. core(). 2. Functions require parentheses because A. They talk in whispers. B. The parentheses keep the function warm. C. The parentheses hold various things required by or belonging to the function. D. None
  • 9. VARIABLES • A variable is a named data storage location on computers memory. By using variable name on our program we are, in effect referring to the data stored there. • For many compilers, a variable name can be up to 31 character long. But it can be actually longer than that) • Rules for naming a variable:- • The name can contain letters, digit and the underscore character(_). • The first character of the name must be a letter. The underscore is also legal but it’s not recommended. • Case matters. • C keywords cannot be used as a variable name. • It should not contain any other special character than underscore(_). • A variable name mustn’t have any embedded space.
  • 10. • Declaring a variable:- • A variable declaration tells the compiler the name and the type of a variable and optionally initializes the variable to a specific value. • A variable declaration has following form:- Data_type_name variable name; Eg: int roll,num; float percentage; • Data Type: • The data type defines the values that needs to be stored in a program. • C supports mainly two type of data types: 1. Primary data types 2. Derived data types 3. User defined data type
  • 11. PRIMARY DATA TYPE Data type Data sub_type Bytes Format Range Character Signed 1 %c -128 to 127 Unsigned 1 %c 0 to 255 Numeric Sort Signed int 2 %d -32768 to 32767 Sort Unsigned int 2 %d 0 to 65535 Long Signed int 4 %1d -2147483648 to 2147483647 Long Unsigned int 4 %1d 0 to 4294967295 Float 4 %f 3.4E-38 to 3.4E+38 Double 8 %1f 3.7E-308 to 3.4E+308 Long double 10 %1f 3.4E-4932 to 3.4E + 4932
  • 12. • Derived Data Types: • Functions, arrays and pointers are derived data type. • User Defined Data Type: • The user defined datatype identifier can later be used to declare variables. • The user defined data types are: • Structure • Union • Enumeration
  • 13. CONSTANT • A constant is the fixed value that do not change during the execution of the program. • C supports four constants:- • Character • String • Integer • floating-point constants. • The numeric constants(integer and floating-point) must adhere following rules:- 1. Commas and blank spaces cannot be included within the constants. 2. The constant can be preceded by a minus(-) sign if desired. 3. The value of constant cannot exceed specified minimum and maximum bounds
  • 14. QUIZ 1. Which of the following variable name is not a valid variable name? a) Annual_profit b) _2009_tax c) Saving#account d) Year2x5_abc 2. How many bytes of memory does a double data type take ? a) -32768 to 32767 b) 0 to 255 c) 4 d) 8
  • 15. 1. Which of the valid format specifier for string type value? a) %d b) %c c) %st d) %s 2. What is the range of short signed Integer? a) -32768 to 32767 b) 0 to 255 c) 0 to 65535 d) 3.7E-308 to 3.4E+308
  • 17. OPERATOR • Operator is a symbol which helps the user to command the computer to do certain mathematical or logical manipulation. • Types of operator • Arithmetic Operator • Assignment Operator • Unary Operator • Relational Operator • Logical Operator • Ternary operator • Comma Operator • Bitwise Operator • Size of Operator
  • 18. 1) Arithmetic Operator Basic mathematical operation. Operator Symbol Addition + Subtraction - Multiplication * Division / Modulus % (Returns Reminder) 2) Assignment Operator Is used to assign Values. Some of them are =,+=,-=,*=,/=,%=
  • 19. 3. Unary Operator: • It is so called because they take a single operand. It acts upon single operand to be increased or decreased by one. • Operator Symbol action Example Increment ++ Increments the operand by one x++,++x Decrement -- Decrements the operand by one x--,--x • They differ in which mode they are used. • When used in prefix mode, the increment and decrement operators modify their operand before it’s used. • When Used in postfix mode, the increment and decrement operators modify their operand after it’s use.
  • 20. 4. Relational Operator:- It is used to compare expressions. An expression containing a relational operator evaluates to either true or false. Operator Symbol Equal == Greater than > Less than < Grater than or equal to >= Less than or equal to <= Not Equal !=
  • 21. 5. Logical Operator:- It let’s us to combine two or more relational expression into a single expression that evaluates to either true or false. Operator Symbol AND && OR || NOT ! 6. Ternary Operator:- It is used to check certain relational expression and execute the true statement if the condition is true and display if the condition is false. Syntax: [condition] ? [true statement]:[false statement] Example: a>b ? printf (“a is greater”) : printf (“b is greater”);
  • 22. 7. Bitwise Operator:- These operators are used for having bit level computations of different values. Operator Meaning & bitwise AND | bitwise OR ^ bitwise exclusive OR >> shift cells right >> shift cells left - one’s complement 6. Size of () Operator:- Returns the number of bytes occupied in the memory Syntax: sizeof(datatype/variable); Example: sizeof(int);
  • 23. ESCAPE SEQUENCE • These are characters not printed when used but provide various functions. These are always started with a backslash ‘’. Commonly Used are:- • Constant Meaning ‘a’ Audible Alert ‘b’ backspace ‘f’ Form feed ‘n’ New Line ‘r’ Carriage Return ‘t’ Horizontal Tab ‘V’ Vertical Tab ‘’’ Single quote ‘”’ Double quote ‘?’ Question mark ‘’ Back slash ‘0’ Null
  • 24. HEADER FILES • Header File contains definition of functions and variables which can be incorporated into any c program by using the preprocessor #include statement. All header files have the extension .h. • Some commonly used Header files: • Stdio.h : It contains the standard input and output functions like printf(), scanf(),gets(),puts() etc. • Conio.h : It contains some of the functions like getch(), clrscr() etc. • Math.h : It contains the mathematical functions like strlen(), strcpy(), strcmp(), strrev() etc. • Ctype.h : it contains some validating functions like isdigit(), isalnum(), isalpha() and some converting functions like toupper(), tolower() etc.
  • 26. • WAP to calculate the area and circumference of a circle . Where radius of a circle is input by user and define pi as constant. • WAP to read principle, time and rate to calculate the simple interest and total amount . • WAP to convert temperature in Fahrenheit into centigrade and vice versa. • WAP to ask cost of pen in Paisa. Convert it into nearest rupees and paisa. • WAP to enter distance between two cities in KM and convert it into meter, centimeter, inch and feet. • WAP to enter any 4 digit number and find the sum of the first and last digit of the number.[e.g. Any four digit number =4567, sum =4+7]. • WAP to supply length and breadth of a rectangle. Find out area and perimeter.
  • 27. • WAP to find total and percentage of the students whose marks are as follows: • WAP to enter 4 digit number and find the sum of them.[e.g. 1234=1+2+3+4=10]. • WAP to interchange the contents of x and y after entering the value of x and y • WAP to read the radius of the sphere and find the volume and area of it. Subjects Marks English 65 Nepali 75 Computer Science 70 Math 80 Account 60
  • 28. • WAP to find the area of triangle after reading the value of base and height. • WAP to find the compound interest. The value principle, time and interest rate is given by user. • WAP to find the area of a triangle, if the length of the side of a triangle are denoted by a, b, c then area of triangle id given by Area= 𝒔 𝒔 − 𝒂 𝒔 − 𝒃 𝒔 − 𝒄 𝐰𝐡𝐞𝐫𝐞 𝒔 = (𝒂+𝒃+𝒄) 𝟐 . • Basic salary of Sabin is input through keyboard. His medical allowance is 10% of the basic salary and provident fund is 10% of the basic salary. WAP to find his net salary. • WAP to solve the quadratic equation a𝒙 𝟐 + b𝒙 + 𝒄 = 𝟎 , 𝒘𝒉𝒆𝒓𝒆 x= −𝒃±𝒃 𝟐−𝟒𝒂𝒄 𝟐𝒂