ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Programming Fundamentals
    CC-112
    Progress0 / 39 topics
    Topics
    1. Introduction to Problem Solving, Algorithms, Programming, and C Language2. Problem Solving, a brief review of Von-Neumann Architecture3. The C Programming Language, Pseudo-code, Concept of Variable4. Data types in Pseudo-code, The C Standard Library and Open Source5. Input/Output, Arithmetic expressions, Assignment statement, Operator precedence6. Concept of Integer division, Flowchart and its notations7. Typical C Program Development Environment, Role of Compiler and Linker8. Test Driving C Application9. Introduction to C Programming: A Simple C Program: Printing Text, Adding Two Integer10. Memory Concepts, Arithmetic in C, Operators11. Decision Making: Equality and Relational Operators12. Structured Program Development: The if, if...else, while Nested Control Statements13. Program Control: for, switch, do...while, break, continue, Logical Operators14. Functions: Modularizing Program in C, Math Library Functions15. Function Definitions and Prototypes, Function-Call Stack and Stack Frames16. Stack rolling and unrolling, Headers, Passing Arguments by Value and by Reference17. Random Number Generation, Scope Rules, Recursion, Recursion vs Iteration18. Arrays: Defining Arrays, Character Arrays, Static and Automatic Local Arrays19. Passing Arrays to Function, Sorting and Searching Arrays20. Multidimensional and Variable Length Arrays21. Pointers: Pointer Definitions and Initialization, Pointer Operators22. Passing Arguments to Function by Reference, Using the const and sizeof Operator23. Pointer Expressions and Arithmetic, Pointers and Arrays, Array of Pointers24. Function Pointers25. Characters and Strings: Strings and Characters, Character Handling Library26. String Functions, Library Functions27. Formatted Input/Output: Streams, Formatted Output with printf, Formatted Input with scanf28. Structures: Defining Structures, Accessing Structure Member, Structures and Functions29. typedef, Unions30. Bit Manipulation and Enumeration: Bitwise Operators, Bit Fields, Enumeration Constants31. File Processing: Files and Streams, Creating, Reading and Writing data to a Sequential and a Random-Access File32. Preprocessor: #include, #define, Conditional Compilation, #error and #pragma33. # and ## Operators, Predefined Symbolic Constants, Assertions34. Other Topics: Variable Length Argument List, Using Command Line Arguments35. Compiling Multiple-Source-File Programs, Program Termination with exit and atexit36. Suffixes for Integer and Floating-Point Literals, Signal Handling37. Dynamic Memory Allocation: calloc and realloc, goto38. Advance Topics: Self-Referential Structures, Linked Lists39. Efficiency of Algorithms, Selection and Insertion Sort
    CC-112›Concept of Integer division, Flowchart and its notations
    Programming FundamentalsTopic 6 of 39

    Concept of Integer division, Flowchart and its notations

    5 minread
    876words
    Beginnerlevel

    Concept of Integer Division in C

    Integer division refers to dividing two integers where the result is also an integer. In C, when performing integer division, the fractional part (or remainder) is discarded, and only the quotient (the integer part) is kept. This means that if you divide two integers, the result is an integer and any remainder is ignored.

    How Integer Division Works in C

    • When both operands are integers, the division operation results in an integer, and any remainder is discarded.
    • If you want to get the quotient and remainder, you can use both the division operator (/) and the modulus operator (%).

    Example of Integer Division

    #include <stdio.h>
    
    int main() {
        int a = 10;
        int b = 3;
        int quotient = a / b;   // Integer division
        int remainder = a % b;  // Modulus to get remainder
        printf("Quotient: %d, Remainder: %d\n", quotient, remainder);
        return 0;
    }
    

    In this example:

    • a / b calculates the quotient, which is 3 (since 10 divided by 3 is 3.333... and the fractional part is discarded).
    • a % b calculates the remainder, which is 1 (since 10 divided by 3 leaves a remainder of 1).

    So, the output would be:

    Quotient: 3, Remainder: 1
    

    Important Notes on Integer Division

    • Negative Results: When dividing two integers where one or both are negative, C truncates the result towards zero. For example, -10 / 3 would result in -3, not -4 (the result is rounded towards zero).
    • Casting: If you want to obtain a floating-point result from the division of integers, you can cast one or both operands to float or double.

    Example with floating-point division:

    #include <stdio.h>
    
    int main() {
        int a = 10;
        int b = 3;
        float result = (float)a / b;  // Casting to float for decimal result
        printf("Result: %.2f\n", result);  // Output: Result: 3.33
        return 0;
    }
    

    Flowchart and Its Notations

    A flowchart is a graphical representation of a process or algorithm. It helps visualize the steps and decisions in a program or system. Flowcharts are widely used in problem-solving, programming, and software design because they provide a clear, step-by-step approach to solving a problem.

    Basic Flowchart Symbols and Notations

    1. Oval (Terminal)
      The oval shape is used to indicate the start and end of a flowchart. It marks the entry and exit points in a process.

      • Start and End are represented by ovals.
      • Notation: An oval with the words "Start" or "End" inside.
      • Example:
        +------------------+
        |      Start       |
        +------------------+
        
    2. Rectangle (Process)
      The rectangle is used to represent a process or operation. It is used to show actions like assignments, calculations, or other operations.

      • Example: A process step where a variable is assigned a value or an arithmetic operation is performed.
      • Notation: A rectangle with the operation or action inside.
        +--------------------+
        |   x = x + 1        |
        +--------------------+
        
    3. Parallelogram (Input/Output)
      The parallelogram shape represents input or output operations. It is used when data is either being received from the user or displayed to the user.

      • Example: Reading input or printing output.
      • Notation: A parallelogram with input or output operation inside.
        +----------------------+
        |   Read x             |
        +----------------------+
        
    4. Diamond (Decision)
      The diamond shape is used to represent a decision or a branching point in the process. It indicates a point where a decision must be made (usually a condition or comparison).

      • Example: A decision such as if or while statement.
      • Notation: A diamond with the condition or decision inside.
        +----------------------+
        | x > 5?               |
        +----------------------+
        
    5. Arrow (Flowline)
      The arrow represents the flow of control in the flowchart. It connects the different symbols and shows the direction in which the process flows.

      • Example: An arrow pointing from one step to the next.
      • Notation: A simple arrow connecting the shapes.
        ---->  (indicating the flow)
        

    Example Flowchart

    Here is an example of a simple flowchart to calculate the sum of two numbers:

    1. Start
    2. Input: Read two numbers, a and b.
    3. Process: Add a and b, store the result in sum.
    4. Output: Print sum.
    5. End

    Flowchart Representation:

              +------------------+
              |      Start       |
              +------------------+
                      |
                      v
              +------------------+
              |  Input a, b      |
              +------------------+
                      |
                      v
              +------------------+
              |  sum = a + b     |
              +------------------+
                      |
                      v
              +------------------+
              |  Output sum      |
              +------------------+
                      |
                      v
              +------------------+
              |      End         |
              +------------------+
    

    Steps to Read the Flowchart:

    1. Start at the "Start" oval.
    2. Read the input values for a and b using the parallelogram shape.
    3. Perform the addition (sum = a + b) inside the rectangle.
    4. Output the result (sum) using another parallelogram.
    5. End the process in the "End" oval.

    Summary

    • Integer Division in C discards the fractional part of the division result, and the remainder can be obtained using the modulus operator %. The result is always an integer.
    • A Flowchart is a visual representation of an algorithm or process, helping to map out steps in a logical sequence. Key flowchart symbols include ovals (Start/End), rectangles (Process), parallelograms (Input/Output), diamonds (Decision), and arrows (Flowlines).
    • Flowcharts are helpful in designing algorithms, ensuring clarity in program structure, and aiding in problem-solving.
    Previous topic 5
    Input/Output, Arithmetic expressions, Assignment statement, Operator precedence
    Next topic 7
    Typical C Program Development Environment, Role of Compiler and Linker

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time5 min
      Word count876
      Code examples0
      DifficultyBeginner