PUNJAB COLLEGE OF TECHNICAL EDUCATION, LUDHIANA



Name of Teacher: Swati Singhal (SSG)                   Subject Name: Programming in C
Email Id: swati.singhal84@yahoo.com                    Subject Code: BC-104 (N2)
Assignments: 3                                         Total Lectures: 40
                      Tests: 4                                         Revision Lectures: 4


Max. Marks 100

Internal Assessment 40
External Assessment 60

Instructions for Candidates
Candidates are required to attempt four questions from section B and the entire section A.
Use of non-programmable scientific calculator is allowed.

Fundamentals: Character set, Identifiers & Keywords, Data Types, constants, set,
constants, variables, expressions, statement, symbolic constants. Operations and
expressions: Arithmetic operators, unary operators, relational and logical operators,
assignment and conditional operators, and library functions.

Data input and output: Preliminaries, single character input, single character output,
entering input data, more about the scanf() function, writing output data, more about
printf function, the gets and puts function, interactive programming.

Control statements: Preliminaries, while, do-while and for statements. Nested loops, if
else, switch, break continue statement.

Functions: Brief overview, defining accessing function, passing perimeters to function,
specifying argument data types, function prototype and recursion.

Program structure: Storage classes, automatic, external, and static variables, more
about library functions.

Array: defining and processing an array, passing pointers to a function, pointer and one
dimensional arrays, operations on pointers, passing functions multidimensional arrays of
pointers, passing functions to the other functions, more about pointer declarations.

Structure And Unions: Defining and processing a structure, user defined data types,
structure and Pointers, passing structure to function, self-referential structures, unions.

Data files: Opening, closing, creating, and processing and unformatted data field.
C-programming applications: Sorting (Bubble sort, Selection sort), Searching (Binary
                                 search, Linear Search).




REFERENCE:

1. E.Balaguruswamy           Programming in ANSI ‘C’               (Tata McGraw
Hill)

2. Byron Gottorfried         Schaum’s outline of programming with C (Tata McGraw
Hill)

3. Kerighan & Richie         The C programming language            (PHI Publication)

4. Lafore R.                 Object Oriented Programming          (Galgotia)

5. Aaron M. Tannen Baum      Data structures using C             (PHI publication)
Punjab College of Technical Education, Ludhiana
                                     Course Plan


Subject Name: Programming in C                              Subject         BC-104(N2)
                                                            Code:
Teacher's Code: SSG                                         No. of Tests:   4
No. of     40                                               No. of          4
Lect.                                                       Assignments



Lect. No   Topic                               Assignment   Test            Status
1          Fundamentals : Computer
           Languages, Compiler,
           Assembler
2          Problem Solving with
           Computers, Algorithms with
           examples
3          Flow charts with examples
4          Program structure of a simple
           C Program
5          Introduction to Character set,
           Identifiers, Keywords, Data
           Types
6          Constants, variables,
           expressions.
7          Statement, symbolic constants
8          Operations and expressions:
           Arithmetic operators, unary
           operators, relational and logical
           operators
9          Assignment and conditional                       test1
           operators, and library
           functions.
10   Data input and output:
     Preliminaries (printf,
     scanf),Single character output,
     entering input data, Writing
     output data, gets and puts
     function

11   Format Specifiers /Delimiters
     and Escape Sequences

12   Interactive programming              Assignment
     (creating User Friendly              1
     Programs)
13   Control statements:
     Preliminaries
14   If statements
15                                                     Test 2
     if else if, Nested if else, ladder
     if else statements
16   while, do-while statements
17   for statements, Nested loops

18   switch case Statement
19   break and continue statement
20   Functions: definition, uses,
     types of functions(inbuilt, user
     defined)
21   Predefined Functions: string
     function, mathematical
     functions
22   user defined function: defining,
     calling and prototype of
     function
23   Passing parameters to function, Assignment
     Specifying argument data types 2

24   Recursion
25   Storage classes, automatic,
     external, and static variables
26   User defined data types: enum,
     typedef
27   Array: Defining and                            test3
     processing an array
28   Types of arrays : one and two
     dimensional arrays
29   Array and Function
30   Introduction to pointers
31   Pointer and one dimensional
     arrays
32   Pointer Arithmetic
33   Structure :Defining and           Assignment
     processing structure              3

34   Structure and pointers, passing
     structure to function

35   Self-referential structures
36   Union: definition, uses,                       test4
     difference b/w union and
     structure
37   Introduction to data files:
     Opening and Closing files

38   Creating and processing,
     Unformatted data field
39     C-programming
       applications: Linear search,
       Binary search
40     Bubble sort, Selection sort



     Reference:
     1 Yashwant Kanetkar “Let us C”
     2. E.Balaguruswamy Programming in ANSI ‘C’ (Tata McGraw Hill)
     3. Schaum’s series for data structure (Tata McGraw Hill)




                                 Class Exercise
Simple calculations:

  1. Write a program to print your name on screen.
  2. Write a program to print addition, subtraction, multiplication, division
     of two numbers.
  3. Write a program to find the simple interest.
  4. Write a program to print area of circle, rectangle and square.
Conditional:

  5. Write a program to check whether a person can vote or not.
  6. Program to show the use of conditional operator (Greatest among two
     numbers)
  7. Write a program to check whether the given number is positive or not.
  8. Write a program to check whether a given year is leap or not.
Switch and Strings:
  9. Program to use switch statement. Display Monday to Sunday:
  10.Write a program for various operations on strings.
Loops:
  11.Write a program to print table of tables.
  12.Write a Program to print the EVEN numbers out of first 100 numbers.
  13.Write a Program to Print the following:
     a)
                         1
                         1     2
                         1     2      3
                         1     2      3     4
                         1     2      3     4       5
     b)
                         1
2     2
                         3     3      3
                         4     4      4      4
                         5     5      5      5     5
     c)
                         1
                         2     3
                         4     5      6
                         7     8      9      10
  14. Write a program to find the factorial of a number.

  15.Accept a three digit number from the user and print it in reverse.
Arrays:
  16.Write a program to enter a one dimensional array and print the
     elements in reverse order.
  17.Write a program to enter ‘n’ elements in one dimensional array and
     find the average of all the elements.
  18.Write a program to print the sum of the diagonal elements of a matrix.
  19.Write a program to enter a two dimensional array and print it in
     matrix form.
  20.Write a program to find the addition of two matrices.
  21.Write a program to print the transpose of a matrix.
Structure:
  22. WAP to enter the database of student in structure and print it.
Pointers:
  23.Write a program to illustrate the operations performed on pointers.
  24.Write a program to swap two numbers by using call by value.
Functions:

  25.Write a program to find the factorial of a number.
26.Write a program to find the reverse of a given number.
  27.Write a program to print the factorial of a number using recursion.


File Handling:
  28.WAP to for file handling.
PROGRAMS FOR PRACTICAL FILE


Simple Calculations:
  1. Program to convert temperature from degree centigrade to Fahrenheit:
  2. Write a program to calculate the Gross salary of an employee.

Conditional :
  3. Write a program to check whether the given number is even or odd

     (By using conditional operator).
  4. Write a program to print the largest of three numbers.
  5. Write a Program to calculate the percentage of a student in 5 subjects

     and then find his grade accordingly.

Switch and Strings:

  6. Program to display arithmetic operator using switch case.
  7. Write a program to check whether the entered string is palindrome or
     not by using string functions.
Loops:
  8. Write a program to find the sum of n natural numbers.
  9. Write a Program to print the PRIME numbers out of first 100
     numbers.
  10.Write a Program to Print the Fibonacci series up to n numbers.
  11.Write a program to check whether the entered number is Armstrong
     Number or not.
  12.Write a program to check whether the entered number is Palindrome
     or not.
13.Write a Program to Print the following:


                                            1
                                     1      2     1
                                1    2      3     2      1
                        1       2    3      4     3      2     1
                  1     2       3    4      5     4      3     2      1


Arrays:
  14.Write a program to print the multiplication of two matrices.
  15.Write a program to search an element from an array using linear
     search.
  16. Write a program to search an element from an array using binary
     search.
  17. Write a program to sort the elements of an array using bubble sort.
  18. Write a program to sort the elements of an array using selection sort
Structure:
  19.WAP to enter the data of 5 students and print the data of the student
     with highest percentage.
Pointers:
  20.Write a program to swap two numbers by using call by reference.
Functions:
  21.Write a program to print the Fibonacci series using recursion.
  22.Write a program to pass the structure into a function and then print the
     values.
  23. Write a program to pass an array into a function and then print the
     elements in reverse order.
File handling:
   24.Write a program using file handling to read the data from one file and
      then copy it to another file.

Course Breakup Plan- C

  • 1.
    PUNJAB COLLEGE OFTECHNICAL EDUCATION, LUDHIANA Name of Teacher: Swati Singhal (SSG) Subject Name: Programming in C Email Id: swati.singhal84@yahoo.com Subject Code: BC-104 (N2) Assignments: 3 Total Lectures: 40 Tests: 4 Revision Lectures: 4 Max. Marks 100 Internal Assessment 40 External Assessment 60 Instructions for Candidates Candidates are required to attempt four questions from section B and the entire section A. Use of non-programmable scientific calculator is allowed. Fundamentals: Character set, Identifiers & Keywords, Data Types, constants, set, constants, variables, expressions, statement, symbolic constants. Operations and expressions: Arithmetic operators, unary operators, relational and logical operators, assignment and conditional operators, and library functions. Data input and output: Preliminaries, single character input, single character output, entering input data, more about the scanf() function, writing output data, more about printf function, the gets and puts function, interactive programming. Control statements: Preliminaries, while, do-while and for statements. Nested loops, if else, switch, break continue statement. Functions: Brief overview, defining accessing function, passing perimeters to function, specifying argument data types, function prototype and recursion. Program structure: Storage classes, automatic, external, and static variables, more about library functions. Array: defining and processing an array, passing pointers to a function, pointer and one dimensional arrays, operations on pointers, passing functions multidimensional arrays of pointers, passing functions to the other functions, more about pointer declarations. Structure And Unions: Defining and processing a structure, user defined data types, structure and Pointers, passing structure to function, self-referential structures, unions. Data files: Opening, closing, creating, and processing and unformatted data field.
  • 2.
    C-programming applications: Sorting(Bubble sort, Selection sort), Searching (Binary search, Linear Search). REFERENCE: 1. E.Balaguruswamy Programming in ANSI ‘C’ (Tata McGraw Hill) 2. Byron Gottorfried Schaum’s outline of programming with C (Tata McGraw Hill) 3. Kerighan & Richie The C programming language (PHI Publication) 4. Lafore R. Object Oriented Programming (Galgotia) 5. Aaron M. Tannen Baum Data structures using C (PHI publication)
  • 3.
    Punjab College ofTechnical Education, Ludhiana Course Plan Subject Name: Programming in C Subject BC-104(N2) Code: Teacher's Code: SSG No. of Tests: 4 No. of 40 No. of 4 Lect. Assignments Lect. No Topic Assignment Test Status 1 Fundamentals : Computer Languages, Compiler, Assembler 2 Problem Solving with Computers, Algorithms with examples 3 Flow charts with examples 4 Program structure of a simple C Program 5 Introduction to Character set, Identifiers, Keywords, Data Types 6 Constants, variables, expressions. 7 Statement, symbolic constants 8 Operations and expressions: Arithmetic operators, unary operators, relational and logical operators 9 Assignment and conditional test1 operators, and library functions.
  • 4.
    10 Data input and output: Preliminaries (printf, scanf),Single character output, entering input data, Writing output data, gets and puts function 11 Format Specifiers /Delimiters and Escape Sequences 12 Interactive programming Assignment (creating User Friendly 1 Programs) 13 Control statements: Preliminaries 14 If statements 15 Test 2 if else if, Nested if else, ladder if else statements 16 while, do-while statements 17 for statements, Nested loops 18 switch case Statement 19 break and continue statement 20 Functions: definition, uses, types of functions(inbuilt, user defined) 21 Predefined Functions: string function, mathematical functions 22 user defined function: defining, calling and prototype of function
  • 5.
    23 Passing parameters to function, Assignment Specifying argument data types 2 24 Recursion 25 Storage classes, automatic, external, and static variables 26 User defined data types: enum, typedef 27 Array: Defining and test3 processing an array 28 Types of arrays : one and two dimensional arrays 29 Array and Function 30 Introduction to pointers 31 Pointer and one dimensional arrays 32 Pointer Arithmetic 33 Structure :Defining and Assignment processing structure 3 34 Structure and pointers, passing structure to function 35 Self-referential structures 36 Union: definition, uses, test4 difference b/w union and structure 37 Introduction to data files: Opening and Closing files 38 Creating and processing, Unformatted data field
  • 6.
    39 C-programming applications: Linear search, Binary search 40 Bubble sort, Selection sort Reference: 1 Yashwant Kanetkar “Let us C” 2. E.Balaguruswamy Programming in ANSI ‘C’ (Tata McGraw Hill) 3. Schaum’s series for data structure (Tata McGraw Hill) Class Exercise
  • 7.
    Simple calculations: 1. Write a program to print your name on screen. 2. Write a program to print addition, subtraction, multiplication, division of two numbers. 3. Write a program to find the simple interest. 4. Write a program to print area of circle, rectangle and square. Conditional: 5. Write a program to check whether a person can vote or not. 6. Program to show the use of conditional operator (Greatest among two numbers) 7. Write a program to check whether the given number is positive or not. 8. Write a program to check whether a given year is leap or not. Switch and Strings: 9. Program to use switch statement. Display Monday to Sunday: 10.Write a program for various operations on strings. Loops: 11.Write a program to print table of tables. 12.Write a Program to print the EVEN numbers out of first 100 numbers. 13.Write a Program to Print the following: a) 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 b) 1
  • 8.
    2 2 3 3 3 4 4 4 4 5 5 5 5 5 c) 1 2 3 4 5 6 7 8 9 10 14. Write a program to find the factorial of a number. 15.Accept a three digit number from the user and print it in reverse. Arrays: 16.Write a program to enter a one dimensional array and print the elements in reverse order. 17.Write a program to enter ‘n’ elements in one dimensional array and find the average of all the elements. 18.Write a program to print the sum of the diagonal elements of a matrix. 19.Write a program to enter a two dimensional array and print it in matrix form. 20.Write a program to find the addition of two matrices. 21.Write a program to print the transpose of a matrix. Structure: 22. WAP to enter the database of student in structure and print it. Pointers: 23.Write a program to illustrate the operations performed on pointers. 24.Write a program to swap two numbers by using call by value. Functions: 25.Write a program to find the factorial of a number.
  • 9.
    26.Write a programto find the reverse of a given number. 27.Write a program to print the factorial of a number using recursion. File Handling: 28.WAP to for file handling.
  • 10.
    PROGRAMS FOR PRACTICALFILE Simple Calculations: 1. Program to convert temperature from degree centigrade to Fahrenheit: 2. Write a program to calculate the Gross salary of an employee. Conditional : 3. Write a program to check whether the given number is even or odd (By using conditional operator). 4. Write a program to print the largest of three numbers. 5. Write a Program to calculate the percentage of a student in 5 subjects and then find his grade accordingly. Switch and Strings: 6. Program to display arithmetic operator using switch case. 7. Write a program to check whether the entered string is palindrome or not by using string functions. Loops: 8. Write a program to find the sum of n natural numbers. 9. Write a Program to print the PRIME numbers out of first 100 numbers. 10.Write a Program to Print the Fibonacci series up to n numbers. 11.Write a program to check whether the entered number is Armstrong Number or not. 12.Write a program to check whether the entered number is Palindrome or not.
  • 11.
    13.Write a Programto Print the following: 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 1 2 3 4 5 4 3 2 1 Arrays: 14.Write a program to print the multiplication of two matrices. 15.Write a program to search an element from an array using linear search. 16. Write a program to search an element from an array using binary search. 17. Write a program to sort the elements of an array using bubble sort. 18. Write a program to sort the elements of an array using selection sort Structure: 19.WAP to enter the data of 5 students and print the data of the student with highest percentage. Pointers: 20.Write a program to swap two numbers by using call by reference. Functions: 21.Write a program to print the Fibonacci series using recursion. 22.Write a program to pass the structure into a function and then print the values. 23. Write a program to pass an array into a function and then print the elements in reverse order.
  • 12.
    File handling: 24.Write a program using file handling to read the data from one file and then copy it to another file.