You are previewing Programming Techniques Through C: A Beginner's Companion.
O'Reilly logo
Programming Techniques Through C: A Beginner's Companion

Book Description

A hands-on book on rudiments of programming, Programming Techniques through C: A Beginner's Companion teaches you the techniques of solving problems from simpler ones like "finding out the area of a triangle" to more involved ones like "sorting and searching".

The visual approach to solve problems in a step-by-step manner through flowcharts makes it easy for the beginners to solve problems and write programs using the C programming language. The emphasis is on problem solving procedures rather than learning a language.

Table of Contents

  1. Cover Page
  2. Title Page
  3. Copyright
  4. Contents
  5. Preface
  6. CHAPTER 1: Algorithms and Flowcharts
    1. 1.1 ALGORITHMS
    2. 1.2 FLOWCHARTS
    3. 1.3 DIVIDE AND CONQUER STRATEGY
  7. CHAPTER 2: Basic Techniques
    1. 2.1 SUM OF TWO GIVEN NUMBERS
    2. 2.2 SWAPPING THE CONTENTS OF TWO VARIABLES
    3. 2.3 SIMPLE INTEREST CALCULATION
    4. 2.4 COMPUTING THE AREA OF A CIRCLE GIVEN ITS RADIUS
    5. 2.5 COMPUTING THE AREA OF A TRIANGLE GIVEN ALL ITS SIDES
    6. 2.6 EXTRACTING THE UNIT'S DIGIT OF A GIVEN INTEGER NUMBER
  8. CHAPTER 3: Decision Making
    1. 3.1 LARGEST OF TWO GIVEN NUMBERS
    2. 3.2 DETERMINING WHETHER A GIVEN INTEGER NUMBER IS POSITIVE OR NEGATIVE
    3. 3.3 DETERMINING WHETHER A GIVEN INTEGER NUMBER IS ODD OR EVEN
    4. 3.4 LARGEST OF GIVEN THREE NUMBERS
    5. 3.5 TO FIND OUT WHETHER A GIVEN YEAR IS A LEAP YEAR OR NOT
    6. 3.6 SOLVING A GIVEN QUADRATIC EQUATION
  9. CHAPTER 4: Looping Techniques
    1. 4.1 SUM OF FIRST N NATURAL NUMBERS
    2. 4.2 SUM OF THE SQUARES OF ALL INTEGERS FROM 1 TO N
    3. 4.3 FACTORIAL OF A GIVEN INTEGER
    4. 4.4 FINDING THE SUM OF ODD NUMBERS AND SUM OF EVEN NUMBERS FROM 1 TO N
    5. 4.5 GENERATION OF REQUIRED NUMBER OF TERMS OF THE FIBONACCI SEQUENCE
    6. 4.6 FINDING THE GCD AND LCM OF GIVEN NUMBERS
    7. 4.7 SUM OF ALL THE DIGITS OF A GIVEN INTEGER NUMBER
    8. 4.8 REVERSING A NUMBER AND TO CHECK WHETHER IT IS A PALINDROME OR NOT
    9. 4.9 TO FIND OUT WHETHER A GIVEN INTEGER NUMBER IS PRIME OR NOT
    10. 4.10 PRIME NUMBERS BETWEEN 1 AND N
    11. 4.11 SUM OF FIRST N TERMS IN THE EXPANSION OF SINE SERIES
    12. 4.12 COMPUTING THE AREA OF CIRCLES GIVEN THEIR RADII
  10. CHAPTER 5: Multi-Way Decision Making
    1. 5.1 SOLVING GIVEN QUADRATIC EQUATION USING MULTI-WAY DECISION MAKING FACILITY
    2. 5.2 AWARDING GRADES BASED ON MARKS SCORED IN AN EXAMINATION
    3. 5.3 A SIMPLE CALCULATOR
    4. 5.4 SELECTING AN OPERATION BASED ON A MENU
  11. CHAPTER 6: Arrays
    1. 6.1 READING IN AN ARRAY AND TO OUTPUT THE SAME
    2. 6.2 BIGGEST AMONG GIVEN ‘N’ INTEGER NUMBERS
    3. 6.3 THE MAXIMUM AND MINIMUM AMONG GIVEN N INTEGER NUMBERS
    4. 6.4 AVERAGE OF A GIVEN SET OF N NUMBERS
    5. 6.5 GIVEN N INTEGERS (ZERO, +VE, -VE) TO FIND OUT THE SUM OF +VE NUMBERS, -VE NUMBERS AND THE AVERAGE OF ALL NUMBERS
    6. 6.6 MEAN, VARIANCE AND STANDARD DEVIATION OF A GIVEN SET OF NUMBERS
    7. 6.7 CLASSIFICATION OF THE ELEMENTS OF A GIVEN ARRAY INTO AN ARRAY CONSISTING OF ONLY ODD ELEMENTS AND ANOTHER ARRAY CONSISTING OF ONLY EVEN ELEMENTS.
    8. 6.8 SORTING N NUMBERS IN ASCENDING ORDER USING BUBBLE SORT
    9. 6.9 EVALUATING A POLYNOMIAL
    10. 6.10 READING AND PRINTING OUT A GIVEN MATRIX
    11. 6.11 TO COMPUTE THE SUM/DIFFERENCE OF GIVEN MATRICES
    12. 6.12 TRACE OF A GIVEN MATRIX
    13. 6.13 NORM OF A GIVEN MATRIX
    14. 6.14 TRANSPOSE OF A GIVEN MATRIX
    15. 6.15 PRODUCT OF TWO GIVEN MATRICES
    16. 6.16 SEARCHING A GIVEN ELEMENT IN A GIVEN LIST OF INTEGER ELEMENTS (LINEAR SEARCH ALGORITHM)
    17. 6.17 SEARCHING FOR A GIVEN ELEMENT IN AN ARRAY USING BINARY SEARCH METHOD
    18. 6.18 SORTING A GIVEN ARRAY OF ELEMENTS USING SELECTION SORT
  12. CHAPTER 7: Characters and String Handling
    1. 7.1 FINDING THE LENGTH OF A GIVEN STRING
    2. 7.2 DETERMINING WHETHER A GIVEN STRING IS PALINDROME OR NOT
    3. 7.3 REVERSING A GIVEN STRING
    4. 7.4 COPYING THE CONTENTS OF A GIVEN STRING INTO ANOTHER STRING
    5. 7.5 CONCATENATING TWO GIVEN STRINGS
    6. 7.6 CONVERTING THE UPPERCASE ALPHABETS INTO LOWERCASE ALPHABETS IN A GIVEN STRING AND VICE - VERSA
    7. 7.7 COUNTING THE NUMBER OF VOWELS AND CONSONANTS IN A GIVEN LINE
    8. 7.8 SORTING A GIVEN SET OF NAMES
    9. 7.9 COUNTING THE NUMBER OF CHARACTERS IN AN INPUT
    10. 7.10 COUNTING THE NUMBER OF WORDS IN A GIVEN LINE
    11. 7.11 COUNTING THE NUMBER OF LINES IN A GIVEN TEXT
  13. CHAPTER 8: Solving with Modules
    1. 8.1 FUNCTION TO PRINT A LINE MADE UP OF ONLY HASH (#) CHARACTERS
    2. 8.2 FUNCTION TO MULTIPLY TWO GIVEN INTEGER NUMBERS
    3. 8.3 FUNCTION TO COMPUTE THE GCD OF GIVEN THREE NUMBERS
    4. 8.4 FUNCTION TO SUM FIRST N TERMS OF SINE SERIES EXPANSION AND TO TABULATE SINE VALUES FOR DIFFERENT ANGLES
    5. 8.5 FUNCTIONS TO COMPUTE MEAN AND VARIANCE AND HENCE TO COMPUTE STANDARD DEVIATION OF GIVEN SET OF NUMBERS
    6. 8.6 FUNCTIONS TO READ AND WRITE ONE DIMENSIONAL ARRAY
    7. 8.7 FUNCTION TO SORT AN ARRAY USING BUBBLE SORT METHOD
    8. 8.8 FUNCTION TO SEARCH FOR A REQUIRED ELEMENT USING BINARY SEARCH METHOD
    9. 8.9 FUNCTIONS TO SORT A GIVEN UNSORTED ARRAY USING SELECTION SORT
    10. 8.10 FUNCTIONS TO READ, WRITE AND COMPUTE TRACE OF GIVEN MATRIX
    11. 8.11 FUNCTIONS TO COMPUTE SUM OF EACH ROW, SUM OF EACH COLUMN AND SUM OF ALL ELEMENTS OF GIVEN MATRIX
    12. 8.12 FUNCTIONS TO READ, WRITE AND COMPUTE PRODUCT OF TWO GIVEN MATRICES
    13. 8.13 PROGRAM TO SEARCH FOR REQUIRED ELEMENT IN A GIVEN UNSORTED ARRAY USING FUNCTIONS ON SEPARATE FILE
    14. 8.14 UNDERSTANDING THE MEANING OF LOCAL AND GLOBAL VARIABLES
    15. 8.15 FUNCTION TO SWAP CONTENTS OF TWO VARIABLES—THE WRONG ONE
  14. CHAPTER 9: Pointers
    1. 9.1 UNDERSTANDING PRELIMS OF POINTERS
    2. 9.2 UNDERSTANDING POINTER EXPRESSIONS, POINTER-TO-POINTER AND NULL POINTER
    3. 9.3 FINDING SUM OF ALL ELEMENTS OF ARRAY USING POINTERS
    4. 9.4 FUNCTION TO SWAP CONTENTS OF TWO VARIABLES USING POINTERS
    5. 9.5 SOLVING QUADRATIC EQUATION—USING FUNCTIONS AND POINTERS
  15. CHAPTER 10: Structures
    1. 10.1 DEFINING A STRUCTURE, DECLARING, STRUCTURE VARIABLES, ASSIGNING VALUES TO STRUCTURE MEMBERS AND PRINTING OUT STRUCTURE MEMBER VALUES
    2. 10.2 ARRAY OF STRUCTURE VARIABLES: LISTING NAMES OF STUDENTS WHO HAVE SCORED MORE THAN 60% OF TOTAL MARKS IN THREE SUBJECTS USING STRUCTURE VARIABLES
    3. 10.3 SUM OF TWO COMPLEX NUMBERS-PASSING STRUCTURE VARIABLE TO FUNCTION
    4. 10.4 ARRAY OF STRUCTURE VARIABLES WITH A STRUCTURE AS MEMBER OF ANOTHER STRUCTURE
  16. Index