CSA1501 Problem solving using C Lab -60 hours
Course Code Course Title: Problem solving using C
CSA1501 Type of Course: Program Core L-T-P-C 0 0 4 2
Theory and Laboratory Integrated
Version No. 1.0
Course Pre- NIL
requisites
Anti-requisites NIL
Course This course introduces the fundamentals of C programming, including
Description data types, control structures, arrays, and strings. Students will analyze
problems, draw flowcharts, and implement solutions using modular
programming techniques. The course also covers advanced topics such
as functions, structures, unions, and pointers for efficient problem-
solving.
Course The objective of the course is to familiarize the learners with the
Objectives concepts of Problem-Solving Using C and attain Skill Development
through Experiential Learning techniques.
Course Out On successful completion of the course the students shall be able to:
Comes CO1: Apply the basic structure and fundamental concepts of C
programming to write simple programs for problem-solving. [Apply]
CO2: Apply control structures such as conditional and looping
statements to develop logic-driven programs in C. [Apply]
CO3: Apply the concepts of arrays and strings to implement programs
for data storage, manipulation, and simple text processing. [Apply]
CO4: Apply the advanced features of C such as functions, structures,
unions, pointers, and file handling to build modular and efficient
applications [Apply].
List of Laboratory Tasks:
Laboratory Lab Sheets
Module 1: Introduction to C Programming
Lab Sheet 1
Level-1 Write a C program to display "Hello World".
Level-2 : Modify the program to print your name and branch.
Lab Sheet 2
a) Write a C program to perform addition, subtraction, multiplication, and division of two numbers.
b) Extend the program to calculate modulus and display all results clearly.
Lab Sheet 3
a) Write a C program to swap two numbers using a temporary variable.
b) Rewrite the same program without using a temporary variable.
Lab Sheet 4
a) Write a program to demonstrate the use of different data types and print their sizes using `sizeof`.
b) Explain the importance of each data type in comments within your code.
Lab Sheet 5
a) Write a program to take input from the user for age and print whether the user is eligible to vote or
not.
b) Modify the program to check eligibility for driving (minimum age 18).
Module 2: Control Statements in C
Lab Sheet 6
a) Write a program to find the largest of two numbers using `if-else`.
b) Extend the program to find the largest among three numbers.
Lab Sheet 7
a) Write a program to check whether a given number is even or odd.
b) Modify the program to check whether a given number is positive, negative, or zero.
Lab Sheet 8
a) Write a program to display the day of the week using `switch-case`.
b) Extend it to handle invalid inputs with a default case.
Lab Sheet 9
a) Write a program to print numbers from 1 to 10 using a `while` loop.
b) Rewrite the same using a `for` loop and a `do-while` loop.
Lab Sheet 10
a) Write a program to display the multiplication table of a given number.
b) Modify the program to display tables from 1 to 10 using nested loops.
Lab Sheet 11
a) Write a program to find the sum of digits of a given number.
b) Extend it to check whether the given number is a palindrome.
Module 3: Arrays and Strings
Lab Sheet 12
a) Write a program to read and display elements of a one-dimensional array.
b) Modify the program to find the sum and average of array elements.
Lab Sheet 13
a) Write a program to find the maximum and minimum elements in an array.
b) Extend it to find the second largest element.
Lab Sheet 14
a) Write a program to insert an element at a specific position in an array.
b) Modify it to delete an element from a specified position.
Lab Sheet 15
a) Write a program to add two matrices.
b) Extend the program to subtract two matrices.
Lab Sheet 16
a) Write a program to find the transpose of a matrix.
b) Modify it to check whether a matrix is symmetric.
Lab Sheet 17
a) Write a program to read and print a string.
b) Modify it to count the number of vowels and consonants in the string.
Lab Sheet 18
a) Write a program to reverse a string.
b) Extend it to check whether the string is a palindrome.
Lab Sheet 19
a) Write a program to concatenate two strings using library functions.
b) Rewrite without using library functions.
Lab Sheet 20
a) Write a program to copy one string to another using `strcpy`.
b) Modify it to compare two strings using `strcmp` and print whether they are equal.
Module 4: Functions, Structures, Unions, Pointers, and File Handling
Lab Sheet 21
a) Write a program to demonstrate a function without arguments and without return value.
b) Modify it to include arguments but no return value.
Lab Sheet 22
a) Write a function to find factorial of a number using recursion.
b) Modify the program to find the nth Fibonacci number using recursion.
Lab Sheet 23
a) Write a program to demonstrate call by value.
b) Extend it to demonstrate call by reference using pointers.
Lab Sheet 24
a) Define a structure to store student information (name, roll, marks).
b) Write a program to read and display details of n students.
Lab Sheet 25
a) Write a program to demonstrate use of union to store different data types.
b) Compare memory size of structure and union with the same members.
Lab Sheet 26
a) Write a program to illustrate pointer arithmetic (increment and decrement).
b) Modify it to demonstrate pointer to array elements.
Lab Sheet 27
a) Write a program to swap two numbers using pointers.
b) Modify it to sort an array using pointers.
Lab Sheet 28
a) Write a program to write data to a file using `fprintf`.
b) Modify the program to read the data back using `fscanf`.
Lab Sheet 29
a) Write a program to copy content from one file to another.
b) Modify it to count the number of lines and words in a file.
Lab Sheet 30
a) Write a program to store and retrieve employee records using file handling.
b) Extend it to search for an employee by ID and update their salary.
Text Book
T1. E. Balaguruswamy, “Programming in ANSI C”, Eighth Edition - Tata McGraw Hill.
References Books
R1. Behrouz A Forouzan, Richard F Gilberg, “Computer Science: A structured
programming approach using C”, Third Edition Cengage Learning.
R2. Brian W. Kernighan / Dennis Ritchie, “The C Programming Language “ ,Second Edition,
Pearson
YashavantKanetkar, “Let Us C”, Eighteenth edition , BPB Publications
Online Resources
W1,. https://www.coursera.org/learn/introducton- to programming-in-c (Coursera)
https://presiuniv.knimbus.com/user#/viewDetail?searchResultType=ECATALOGUE
_W2. BASED&unique_id=DOAJ_1_02082022_1773 (E-Library Resource)
https://onlinecourses.nptel.ac.in/noc22_cs32/preview (NPTEL)