SlideShare a Scribd company logo
1 of 28
C PROGRAMING
Name: Dipjwal Giri
Section :M21
Submitted to :Sandeep Shrestha
C Programming Languages
C is a general-purpose programming language that is extremely popular, simple, and
flexible to use. It is a structured programming language that is machine-independent and
extensively used to write various applications, Operating Systems like Windows, and many
other complex programs like Oracle database, Git, Python interpreter, and more. The C
programming language came out of Bell Labs in the early 1970s. According to the Bell Labs
paper The Development Of C Language by Dennis Ritchie, “The C programming language was
devised in the early 1970s as a system implementation language for the nascent Unix operating
system. Derived from the typeless language BCPL, it evolved a type structure; created on a tiny
machine as a tool to improve a meager programming environment.” Originally, Ken Thompson, a
Bell Labs employee, desired to make a programming language for the new Unix platform.
Thompson modified the BCPL system language and created B. However, not many utilities were
ever written in B due to its slow nature and inability to take advantage of PDP-11 features in the
operating system. This led to Ritchie improving on B, and thus creating C.
Variable And Constant
 A variable is an identifier which value may change during the execution of the program. For example, in the expression
i=i+1, i is a variable.
 A constant is an identifier in which value remains fixed or unchanged throughout the program. For example, in an
expression, Area=3.14*r*r, 3.14 is the constant.
Operand, Operator, and Operation
 In computer programming , an operand is a term used to explain any object that is capable of being manipulated. In these
two statements: Z-A + B and 18-12-6, there are the "A" and "B" and the "18" and "12" are the operands.
 An operator is a symbol, which defines the operations to be performed on operands. In the statement of "A+ B" and "18-
12", there are the "+" and "-" are the operators.
 An Operation is a result of an expression. The operation is defined by the operator. It can be defined as the action upon
data. For example, in a mathematical expression, "A+B" or "18-12" and "Z" and "6" are the results of the operation or
result of the expression.
Programming Design Tools
Program design tools are used to design a program before it is actually developed.
It is used by the designers.
Some of the commonly used tools in programming are:
◦ Algorithm
◦ Pseudo code
◦ Flowchart
Algorithm
Definition
An algorithm is the finite set of step-by-step set of
statements that solve a particular problem.
Example
◦ Find the sum of the two numbers.
◦ Step 1: START.
◦ Step 2: Read the two numbers A and B.
◦ Step 3: Add the number A and B and store in D.
or D=A+B
◦ .Step 4: Display D or print D.
◦ Step 5: STOP.
Flow Chart
Definition
A flow chart is a diagrammatic
(pictorial) representation that
illustrates the sequence of operations
to be performed.
Pseudo Code
Definition
Pseudo Code is a notation resembling a
simplified programming language, used in
program design.
Example
Q. Computing Sales Tax: Pseudo-code the task of computing the final price of an
item after figuring in sales tax. Note the three types of instructions: input (get),
process/calculate (=) and output (display).
get the price of the item
get sales tax rate
sales tax = price of item times sales tax rate
final price = price of the item plus sales tax
display final price
halt
C tokens
C tokens are the basic buildings blocks in C language which are constructed together to
write a C program.
C token includes:
oIdentifier
oKeyword
oConstant And Variable
oOperator
Identifier
An identifier is a combination of alphanumeric characters. An identifier can be
composed of letters such as uppercase, lowercase letters, underscore, digits, but the
starting letter should be either an alphabet or an underscore. If the identifier is not used
in the external linkage, then it is called as an internal identifier. If the identifier is used in
the external linkage, then it is called as an external identifier. We can say that an
identifier is a collection of alphanumeric characters that begins either with an
alphabetical character or an underscore, which are used to represent various
programming elements such as variables, functions, arrays, structures, unions, labels,
etc. There are 52 alphabetical characters (uppercase and lowercase), underscore
character, and ten numerical digits (0-9) that represent the identifiers. There is a total of
63 alphanumerical characters that represent the identifiers.
Keyword
Definition
Keywords are predefined, reserved
words used in programming that have
special meanings to the compiler
Keywords
auto break case char
const continue default do
double else enum extern
float for goto if
int long register return
short signed sizeof static
struct switch typedef union
unsigned void volatile while
Variable And Constant
Definition
 A variable is an identifier which value may
change during the execution of the program.
For example, in the expression i=i+1, i is a
variable.
 A constant is an identifier in which value
remains fixed or unchanged throughout the
program. For example, in an expression,
Area=3.14*r*r, 3.14 is the constant.
Constant V/S Variable
Variable
◦ Variables also have its uses in computer programming and
applications.
◦ Variables, on the other hand, represent the unknown
values.
◦ Variables are specially written in letters or symbols.
◦ A variable, on the other hand, changes its value dependent
on the equation.
Constant
◦ Constants are used in computer programming.
◦ Constants usually represent the known values in an
equation, expression or in line of programming.
◦ Constants are usually written in numbers
◦ A constant does not change its value over time.
Operators and Expressions
An operator is a symbol that instructs C to perform some operation or action on one or more operands.
Types of operators are
◦ Relational operator
◦ Increment/Decrement operator
◦ Logical operator
◦ Arithmetic operator
◦ Equality operator
◦ Assignment operator
◦ Conditional operator (Ternary operator)
◦ Special operator
◦ Bitwise operator
Arithmetic operator
 An arithmetic operator is a mathematical function that takes two operands and performs a calculation on
them
Relational operator
◦ Relational operator is a symbol that determines the relationship between two different operands.
Logical operator
Logical operator is a symbol that logically connects the logical expressions i.e. it is used to connect
two or more expressions.
Other Operators Definitions
◦ Equality operator: The equality operator (==) is used to compare two values or
expressions.
◦ Increment/Decrement operator: Increment and decrement operators are unary operators
that add or subtract one, to or from their operand, respectively
◦ Assignment operator: An assignment operator is the operator used to assign a new
value to a variable, property, event or indexer element.
◦ Conditional operator: Conditional operators are used to evaluate a condition that's
applied to one or two Boolean expressions.
◦ Bitwise operator: Bitwise operators are characters that represent actions to be
performed on single bits.
◦ Special operator: These operators are used to either increase or decrease the value of
the variable by one is special operators.
Control Structures
Types of control structures are :
 Sequence
 Decision
 Looping
 Jump
 Label
Sequence Control Structures
Definition
Sequence is the default control structure;
instructions are executed one after another
C program
#include
#include
void main()
{
clrscr();
int x , y, sum;
printf(“enter the two numbers”);
scanf(“%d%d”,&x,&y);
sum=x+y;
printf(“the sum of the two numbers is =%d”,sum);
getch();
}
Decision Control Structures
Definition
The decision control statements are the
decision making statements that decides
the order of execution of statements
based on the conditions
Types of decision control structures
• nested if statements
• if-else statements
• if statements
Flowchart
Decision (if)
Syntax
if(expression)
statement;
OR
if(expression)
{
statement;
statement;
}
Flowchart
Decision(if else)
Syntax
 If (expression)
statementl;
else
statement
OR
 If (expression)
{
statement1;
statement2;
}
Else
{
statement3;
statement4;
}
Flowchart
Decision(nested if statements)
Syntax
if (expressionl)
{
If(expression2)
Statement1;
Else
Statement2;
}
Else
{
if (expression3)
Statement3;
Else
Statement4;
}
Flowchart
Looping
A loop is a programming structure that repeats a sequence of instructions until a
specific condition is met.
Types of looping are:
• for statement
• while statement
• do…while statement
Looping(FOR)
Syntax Flowchart
// Print numbers from 1 to 10
#include <stdio.h>
int main() {
int i;
for (i = 1; i < 11; ++i)
{
printf("%d", i);
}
return 0;A
}
Looping(while)
Syntax
// Print numbers from 1 to 5
#include <stdio.h>
int main() {
int i=1:
while (I <= 5) {
printf("%dn", 1):
++i:
}
return 0;
}
Flowchart
Looping(do..while)
Syntax
#include <stdio.h>
int main() {
double number, sum = 0;
// the body of the loop is executed at least once do {
printf("Enter a number: ");
scanf("%lf", &number);
sum += number;
}
while(number != 0.0);
printf("Sum = %.2lf",sum);
return 0;
}
Flowchart
THANK YOU

More Related Content

Similar to C PROGRAMMING FUNDAMENTALS

Fundamentals of c language
Fundamentals of c languageFundamentals of c language
Fundamentals of c languageAkshhayPatel
 
2 EPT 162 Lecture 2
2 EPT 162 Lecture 22 EPT 162 Lecture 2
2 EPT 162 Lecture 2Don Dooley
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxLikhil181
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to cHattori Sidek
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C ProgrammingMOHAMAD NOH AHMAD
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 FocJAYA
 
Compiler Construction.pptx
Compiler Construction.pptxCompiler Construction.pptx
Compiler Construction.pptxBilalImran17
 
INTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxINTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxMamataAnilgod
 
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
 
Sample for Simple C Program - R.D.Sivakumar
Sample for Simple C Program - R.D.SivakumarSample for Simple C Program - R.D.Sivakumar
Sample for Simple C Program - R.D.SivakumarSivakumar R D .
 
Introduction to C Programming - I
Introduction to C Programming - I Introduction to C Programming - I
Introduction to C Programming - I vampugani
 

Similar to C PROGRAMMING FUNDAMENTALS (20)

Fundamentals of c language
Fundamentals of c languageFundamentals of c language
Fundamentals of c language
 
2 EPT 162 Lecture 2
2 EPT 162 Lecture 22 EPT 162 Lecture 2
2 EPT 162 Lecture 2
 
Basic Of C language
Basic Of C languageBasic Of C language
Basic Of C language
 
Pc module1
Pc module1Pc module1
Pc module1
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx
 
C intro
C introC intro
C intro
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to c
 
Introduction%20C.pptx
Introduction%20C.pptxIntroduction%20C.pptx
Introduction%20C.pptx
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
 
Compiler Construction.pptx
Compiler Construction.pptxCompiler Construction.pptx
Compiler Construction.pptx
 
CProgrammingTutorial
CProgrammingTutorialCProgrammingTutorial
CProgrammingTutorial
 
Basics of c
Basics of cBasics of c
Basics of c
 
C-PPT.pdf
C-PPT.pdfC-PPT.pdf
C-PPT.pdf
 
INTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxINTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptx
 
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
 
C programming
C programmingC programming
C programming
 
Basics of c++
Basics of c++Basics of c++
Basics of c++
 
Sample for Simple C Program - R.D.Sivakumar
Sample for Simple C Program - R.D.SivakumarSample for Simple C Program - R.D.Sivakumar
Sample for Simple C Program - R.D.Sivakumar
 
Introduction to C Programming - I
Introduction to C Programming - I Introduction to C Programming - I
Introduction to C Programming - I
 

Recently uploaded

EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 

Recently uploaded (20)

EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 

C PROGRAMMING FUNDAMENTALS

  • 1. C PROGRAMING Name: Dipjwal Giri Section :M21 Submitted to :Sandeep Shrestha
  • 2. C Programming Languages C is a general-purpose programming language that is extremely popular, simple, and flexible to use. It is a structured programming language that is machine-independent and extensively used to write various applications, Operating Systems like Windows, and many other complex programs like Oracle database, Git, Python interpreter, and more. The C programming language came out of Bell Labs in the early 1970s. According to the Bell Labs paper The Development Of C Language by Dennis Ritchie, “The C programming language was devised in the early 1970s as a system implementation language for the nascent Unix operating system. Derived from the typeless language BCPL, it evolved a type structure; created on a tiny machine as a tool to improve a meager programming environment.” Originally, Ken Thompson, a Bell Labs employee, desired to make a programming language for the new Unix platform. Thompson modified the BCPL system language and created B. However, not many utilities were ever written in B due to its slow nature and inability to take advantage of PDP-11 features in the operating system. This led to Ritchie improving on B, and thus creating C.
  • 3. Variable And Constant  A variable is an identifier which value may change during the execution of the program. For example, in the expression i=i+1, i is a variable.  A constant is an identifier in which value remains fixed or unchanged throughout the program. For example, in an expression, Area=3.14*r*r, 3.14 is the constant. Operand, Operator, and Operation  In computer programming , an operand is a term used to explain any object that is capable of being manipulated. In these two statements: Z-A + B and 18-12-6, there are the "A" and "B" and the "18" and "12" are the operands.  An operator is a symbol, which defines the operations to be performed on operands. In the statement of "A+ B" and "18- 12", there are the "+" and "-" are the operators.  An Operation is a result of an expression. The operation is defined by the operator. It can be defined as the action upon data. For example, in a mathematical expression, "A+B" or "18-12" and "Z" and "6" are the results of the operation or result of the expression.
  • 4. Programming Design Tools Program design tools are used to design a program before it is actually developed. It is used by the designers. Some of the commonly used tools in programming are: ◦ Algorithm ◦ Pseudo code ◦ Flowchart
  • 5. Algorithm Definition An algorithm is the finite set of step-by-step set of statements that solve a particular problem. Example ◦ Find the sum of the two numbers. ◦ Step 1: START. ◦ Step 2: Read the two numbers A and B. ◦ Step 3: Add the number A and B and store in D. or D=A+B ◦ .Step 4: Display D or print D. ◦ Step 5: STOP.
  • 6. Flow Chart Definition A flow chart is a diagrammatic (pictorial) representation that illustrates the sequence of operations to be performed.
  • 7. Pseudo Code Definition Pseudo Code is a notation resembling a simplified programming language, used in program design. Example Q. Computing Sales Tax: Pseudo-code the task of computing the final price of an item after figuring in sales tax. Note the three types of instructions: input (get), process/calculate (=) and output (display). get the price of the item get sales tax rate sales tax = price of item times sales tax rate final price = price of the item plus sales tax display final price halt
  • 8. C tokens C tokens are the basic buildings blocks in C language which are constructed together to write a C program. C token includes: oIdentifier oKeyword oConstant And Variable oOperator
  • 9. Identifier An identifier is a combination of alphanumeric characters. An identifier can be composed of letters such as uppercase, lowercase letters, underscore, digits, but the starting letter should be either an alphabet or an underscore. If the identifier is not used in the external linkage, then it is called as an internal identifier. If the identifier is used in the external linkage, then it is called as an external identifier. We can say that an identifier is a collection of alphanumeric characters that begins either with an alphabetical character or an underscore, which are used to represent various programming elements such as variables, functions, arrays, structures, unions, labels, etc. There are 52 alphabetical characters (uppercase and lowercase), underscore character, and ten numerical digits (0-9) that represent the identifiers. There is a total of 63 alphanumerical characters that represent the identifiers.
  • 10. Keyword Definition Keywords are predefined, reserved words used in programming that have special meanings to the compiler Keywords auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while
  • 11. Variable And Constant Definition  A variable is an identifier which value may change during the execution of the program. For example, in the expression i=i+1, i is a variable.  A constant is an identifier in which value remains fixed or unchanged throughout the program. For example, in an expression, Area=3.14*r*r, 3.14 is the constant.
  • 12. Constant V/S Variable Variable ◦ Variables also have its uses in computer programming and applications. ◦ Variables, on the other hand, represent the unknown values. ◦ Variables are specially written in letters or symbols. ◦ A variable, on the other hand, changes its value dependent on the equation. Constant ◦ Constants are used in computer programming. ◦ Constants usually represent the known values in an equation, expression or in line of programming. ◦ Constants are usually written in numbers ◦ A constant does not change its value over time.
  • 13. Operators and Expressions An operator is a symbol that instructs C to perform some operation or action on one or more operands. Types of operators are ◦ Relational operator ◦ Increment/Decrement operator ◦ Logical operator ◦ Arithmetic operator ◦ Equality operator ◦ Assignment operator ◦ Conditional operator (Ternary operator) ◦ Special operator ◦ Bitwise operator
  • 14. Arithmetic operator  An arithmetic operator is a mathematical function that takes two operands and performs a calculation on them
  • 15. Relational operator ◦ Relational operator is a symbol that determines the relationship between two different operands.
  • 16. Logical operator Logical operator is a symbol that logically connects the logical expressions i.e. it is used to connect two or more expressions.
  • 17. Other Operators Definitions ◦ Equality operator: The equality operator (==) is used to compare two values or expressions. ◦ Increment/Decrement operator: Increment and decrement operators are unary operators that add or subtract one, to or from their operand, respectively ◦ Assignment operator: An assignment operator is the operator used to assign a new value to a variable, property, event or indexer element. ◦ Conditional operator: Conditional operators are used to evaluate a condition that's applied to one or two Boolean expressions. ◦ Bitwise operator: Bitwise operators are characters that represent actions to be performed on single bits. ◦ Special operator: These operators are used to either increase or decrease the value of the variable by one is special operators.
  • 18. Control Structures Types of control structures are :  Sequence  Decision  Looping  Jump  Label
  • 19. Sequence Control Structures Definition Sequence is the default control structure; instructions are executed one after another C program #include #include void main() { clrscr(); int x , y, sum; printf(“enter the two numbers”); scanf(“%d%d”,&x,&y); sum=x+y; printf(“the sum of the two numbers is =%d”,sum); getch(); }
  • 20. Decision Control Structures Definition The decision control statements are the decision making statements that decides the order of execution of statements based on the conditions Types of decision control structures • nested if statements • if-else statements • if statements Flowchart
  • 22. Decision(if else) Syntax  If (expression) statementl; else statement OR  If (expression) { statement1; statement2; } Else { statement3; statement4; } Flowchart
  • 23. Decision(nested if statements) Syntax if (expressionl) { If(expression2) Statement1; Else Statement2; } Else { if (expression3) Statement3; Else Statement4; } Flowchart
  • 24. Looping A loop is a programming structure that repeats a sequence of instructions until a specific condition is met. Types of looping are: • for statement • while statement • do…while statement
  • 25. Looping(FOR) Syntax Flowchart // Print numbers from 1 to 10 #include <stdio.h> int main() { int i; for (i = 1; i < 11; ++i) { printf("%d", i); } return 0;A }
  • 26. Looping(while) Syntax // Print numbers from 1 to 5 #include <stdio.h> int main() { int i=1: while (I <= 5) { printf("%dn", 1): ++i: } return 0; } Flowchart
  • 27. Looping(do..while) Syntax #include <stdio.h> int main() { double number, sum = 0; // the body of the loop is executed at least once do { printf("Enter a number: "); scanf("%lf", &number); sum += number; } while(number != 0.0); printf("Sum = %.2lf",sum); return 0; } Flowchart