SlideShare a Scribd company logo
1 of 20
Created by: Arave
Flowchart
Example flowchart
                                   Begin
Problem: Add 2 numbers
Pseudo code
1. Begin                       Read number 1
2. Read number 1
3. Read number 2
                               Read number 2
4. Add number 1 & number 2
5. End
                             Answer = no1 + no2


                                    End
Example C Programming
 #include <stdio.h> //Preprocessor Directives

 int main ()
 {
 //Local Declaration
    int a, b, sum;

 //Statements
    printf("Enter two numbersn: ");
    scanf("%d %d", &a, &b);

 //Operation
    sum = a + b;

 //Output
    printf("The total is:%d", sum);

     getch ();
     return 0;
 }
C Structure
    Preprocessor Directives
                Global
              Declaration
void main()
{
        Local Declaration
              Statements
}
Preprocessor Directives

 First statement executed by compiler
 Begin with a pound sign or hash ( # )
 Example : #include and #define
Header Files/Libraries

 Header files have the extension .h
 two ways to include a header file:
  1.    #include "stdio.h"
  2.    #include <stdio.h>
Example

#include <stdio.h>          Header
#include <stlib.h>          files
void main()
{
printf("Hello world!!!");

}
Input (printf)

 How to transfer/store the data to
  computer
 Interactive – keyboard, touch
  screen, mouse – response from user
 User understand type of input data
Example

  void main()
  {
     int num1;
     printf(“Key-in number: "); //Input
     scanf(“%d”,&num1);
         .
         .
         .
         .
         .
         .
    return 0;
  }
Escape sequence   functions
        n        New line
       t         Horizontal tab
       v         Vertical tab
       b         backspace
       a         Bell or a beep
                backslash
       ’         Single quote
       ”         double quote
Input (scanf)

 Address in which user input store
  temporary
 Symbol ‘&’ referred to address to the
  variable
Example

  void main()
  {
     int num1; //variable

      printf(“Key-in number: "); //Input

       scanf(“%d”,&num1);
           .
           .
           .
           .
           .
           .
      return 0;
  }
Variable type   scanf Format Specifier
    int               %d, %i
   float                 %f
    char                 %c
 long int               %ld
  string                 %s
  double                %lf
Type of arithmetic operator
Type       Meaning

       *   Multiplication

       /   Division and integer division

           Modulus
       %
       +   Addition

       -   Substraction
Unary Operator


Operator   Example   Description   Equivalent   Statements

   ++        i++;    Postfix        i=i+1;        i+=1;
   ++        ++i;    Prefix         i=i+1;        i+=1;
   --         i--;   Postfix         i=i-1;        i-=1;
   --         --i;   Prefix          i=i-1;        i-=1;
Order of precedence

• Arithmetic Operation Priority

                    High Priority

()          left to right
++, --      left to right
* , /, %    left to right
+,-         left to right
Type of Relational Operator
Operator   Description     Example

  ==       equal to             x==y

  >        greater than          x>y

  <        less than             x<y

  >=       greater or           x>=y
           equal
  <=       less or equal        x<=y

  !=       Not equal to         x!=y
Type of Logical Operator
Operator   Meaning Example

  && AND            ((x<y)&&(x!=0))


  || OR             ((x<y)||(x!=0))


   ! NOT               !(x>=y)
Thank You!

More Related Content

What's hot

What's hot (20)

C programming(Part 1)
C programming(Part 1)C programming(Part 1)
C programming(Part 1)
 
Programming in C (part 2)
Programming in C (part 2)Programming in C (part 2)
Programming in C (part 2)
 
7. input and output functions
7. input and output functions7. input and output functions
7. input and output functions
 
Input output statement in C
Input output statement in CInput output statement in C
Input output statement in C
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
C programming(part 3)
C programming(part 3)C programming(part 3)
C programming(part 3)
 
Input Output Management In C Programming
Input Output Management In C ProgrammingInput Output Management In C Programming
Input Output Management In C Programming
 
Working with IDE
Working with IDEWorking with IDE
Working with IDE
 
Programming in C [Module One]
Programming in C [Module One]Programming in C [Module One]
Programming in C [Module One]
 
Expressions using operator in c
Expressions using operator in cExpressions using operator in c
Expressions using operator in c
 
Decision making and branching
Decision making and branchingDecision making and branching
Decision making and branching
 
What is c
What is cWhat is c
What is c
 
CPU INPUT OUTPUT
CPU INPUT OUTPUT CPU INPUT OUTPUT
CPU INPUT OUTPUT
 
Unit ii ppt
Unit ii pptUnit ii ppt
Unit ii ppt
 
C Programming Language Part 7
C Programming Language Part 7C Programming Language Part 7
C Programming Language Part 7
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4
 
C Programming Language Part 6
C Programming Language Part 6C Programming Language Part 6
C Programming Language Part 6
 
Lecture 6- Intorduction to C Programming
Lecture 6- Intorduction to C ProgrammingLecture 6- Intorduction to C Programming
Lecture 6- Intorduction to C Programming
 
C programming
C programmingC programming
C programming
 
C Programming Language Step by Step Part 5
C Programming Language Step by Step Part 5C Programming Language Step by Step Part 5
C Programming Language Step by Step Part 5
 

Viewers also liked (13)

Flowchart Example
Flowchart ExampleFlowchart Example
Flowchart Example
 
Symbol for drawing flowchart
Symbol for drawing flowchartSymbol for drawing flowchart
Symbol for drawing flowchart
 
Chapter 6 Flowchart
Chapter 6   FlowchartChapter 6   Flowchart
Chapter 6 Flowchart
 
Table Of Flowchart Symbols
Table Of Flowchart SymbolsTable Of Flowchart Symbols
Table Of Flowchart Symbols
 
Flow charts
Flow chartsFlow charts
Flow charts
 
Programming process and flowchart
Programming process and flowchartProgramming process and flowchart
Programming process and flowchart
 
Writing algorithms
Writing algorithmsWriting algorithms
Writing algorithms
 
Flowchart symbols meaning explained
Flowchart symbols meaning explainedFlowchart symbols meaning explained
Flowchart symbols meaning explained
 
Presentation on diagram and flowchart
Presentation on diagram and flowchartPresentation on diagram and flowchart
Presentation on diagram and flowchart
 
Flowchart
FlowchartFlowchart
Flowchart
 
Flow chart powerpoint presentation slides ppt templates
Flow chart powerpoint presentation slides ppt templatesFlow chart powerpoint presentation slides ppt templates
Flow chart powerpoint presentation slides ppt templates
 
Programming flowcharts for C Language
Programming flowcharts for C LanguageProgramming flowcharts for C Language
Programming flowcharts for C Language
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 

Similar to Intro to c chapter cover 1 4

presentation_c_basics_1589366177_381682.pptx
presentation_c_basics_1589366177_381682.pptxpresentation_c_basics_1589366177_381682.pptx
presentation_c_basics_1589366177_381682.pptx
KrishanPalSingh39
 
presentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxpresentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptx
KrishanPalSingh39
 
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
Little Tukta Lita
 

Similar to Intro to c chapter cover 1 4 (20)

2. operator
2. operator2. operator
2. operator
 
C tutorial
C tutorialC tutorial
C tutorial
 
presentation_c_basics_1589366177_381682.pptx
presentation_c_basics_1589366177_381682.pptxpresentation_c_basics_1589366177_381682.pptx
presentation_c_basics_1589366177_381682.pptx
 
Functions
FunctionsFunctions
Functions
 
1 introduction to c program
1 introduction to c program1 introduction to c program
1 introduction to c program
 
7 functions
7  functions7  functions
7 functions
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4
 
Fundamentals of computer programming by Dr. A. Charan Kumari
Fundamentals of computer programming by Dr. A. Charan KumariFundamentals of computer programming by Dr. A. Charan Kumari
Fundamentals of computer programming by Dr. A. Charan Kumari
 
2 EPT 162 Lecture 2
2 EPT 162 Lecture 22 EPT 162 Lecture 2
2 EPT 162 Lecture 2
 
46630497 fun-pointer-1
46630497 fun-pointer-146630497 fun-pointer-1
46630497 fun-pointer-1
 
presentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxpresentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptx
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx
 
Lecture 3 and 4.pptx
Lecture 3 and 4.pptxLecture 3 and 4.pptx
Lecture 3 and 4.pptx
 
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
 
Control structure of c
Control structure of cControl structure of c
Control structure of c
 
Unit 5 Foc
Unit 5 FocUnit 5 Foc
Unit 5 Foc
 
The best every notes on c language is here check it out
The best every notes on c language is here check it outThe best every notes on c language is here check it out
The best every notes on c language is here check it out
 
Operators1.pptx
Operators1.pptxOperators1.pptx
Operators1.pptx
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
 
Understand more about C
Understand more about CUnderstand more about C
Understand more about C
 

Recently uploaded

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
heathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
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
QucHHunhnh
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 

Recently uploaded (20)

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
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
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
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"
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
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
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
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
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
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
 
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
 
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
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).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
 
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
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 

Intro to c chapter cover 1 4

  • 3. Example flowchart Begin Problem: Add 2 numbers Pseudo code 1. Begin Read number 1 2. Read number 1 3. Read number 2 Read number 2 4. Add number 1 & number 2 5. End Answer = no1 + no2 End
  • 4. Example C Programming #include <stdio.h> //Preprocessor Directives int main () { //Local Declaration int a, b, sum; //Statements printf("Enter two numbersn: "); scanf("%d %d", &a, &b); //Operation sum = a + b; //Output printf("The total is:%d", sum); getch (); return 0; }
  • 5. C Structure Preprocessor Directives Global Declaration void main() { Local Declaration Statements }
  • 6. Preprocessor Directives  First statement executed by compiler  Begin with a pound sign or hash ( # )  Example : #include and #define
  • 7. Header Files/Libraries  Header files have the extension .h  two ways to include a header file: 1. #include "stdio.h" 2. #include <stdio.h>
  • 8. Example #include <stdio.h> Header #include <stlib.h> files void main() { printf("Hello world!!!"); }
  • 9. Input (printf)  How to transfer/store the data to computer  Interactive – keyboard, touch screen, mouse – response from user  User understand type of input data
  • 10. Example void main() { int num1; printf(“Key-in number: "); //Input scanf(“%d”,&num1); . . . . . . return 0; }
  • 11. Escape sequence functions n New line t Horizontal tab v Vertical tab b backspace a Bell or a beep backslash ’ Single quote ” double quote
  • 12. Input (scanf)  Address in which user input store temporary  Symbol ‘&’ referred to address to the variable
  • 13. Example void main() { int num1; //variable printf(“Key-in number: "); //Input scanf(“%d”,&num1); . . . . . . return 0; }
  • 14. Variable type scanf Format Specifier int %d, %i float %f char %c long int %ld string %s double %lf
  • 15. Type of arithmetic operator Type Meaning * Multiplication / Division and integer division Modulus % + Addition - Substraction
  • 16. Unary Operator Operator Example Description Equivalent Statements ++ i++; Postfix i=i+1; i+=1; ++ ++i; Prefix i=i+1; i+=1; -- i--; Postfix i=i-1; i-=1; -- --i; Prefix i=i-1; i-=1;
  • 17. Order of precedence • Arithmetic Operation Priority High Priority () left to right ++, -- left to right * , /, % left to right +,- left to right
  • 18. Type of Relational Operator Operator Description Example == equal to x==y > greater than x>y < less than x<y >= greater or x>=y equal <= less or equal x<=y != Not equal to x!=y
  • 19. Type of Logical Operator Operator Meaning Example && AND ((x<y)&&(x!=0)) || OR ((x<y)||(x!=0)) ! NOT !(x>=y)