ACOER23 I
COMPUTER PROGRAMMING LAB
(Common for all branches)
Semester: I L T P C
Course code: 0 0 3 1.5
Course Objectives:
• To provide hands on experience with coding and debugging.
• To encourage collaborative learning and teamwork in coding.
Course Outcomes (COs): At the end of the course, the student will be able to:
CO1: Develop the basic C programs in different environments.
CO2: Utilize appropriate control structures, arrays and strings for problem solving.
CO3: Develop modular programming skill.
CO4: Apply pointers for dynamic memory allocation and file operations for file handling.
CO5: Make use of structures and unions to handle heterogeneous data.
1. Exercise – 1: Explore different platforms
a. Basic Linux environment and its editors like Vi, Vim & Emacs etc.
b. Exposure to Turbo C, gcc
c. Explore to Hacker Rank or any other Online coding platform and compiler
environment.
d. “Hello World” in C
Objective: Learn about the syntax of reading from stdin and writing to stdout.
[Link]
e Write a simple program to read int, float, char and string using scanf() and display
using printf() in all the above given platforms.
2. Exercise – 2: Basics and Operators
a. Sum and Difference of 2 numbers
Objective: Understandint and float data types.
[Link]
c/problem?isFullScreen=true
b. Playing with Characters
Objective: Learn how to take a character, a string and a sentence as input in C.
[Link]
characters/problem?isFullScreen=true
c. Bitwise Operators
Objective: Learn how to work with bits (0,1) and bitwise operators.
Aditya College of Engineering (A) 3
ACOER23 I
[Link]
c/problem?isFullScreen=true
d. Conversion of Fahrenheit to Celsius and vice versa.
e. Distance travelled by an object.
f. Calculate Simple interest and compound interest.
3. Exercise – 3: Operators and Expressions, Variables and Type conversions
a. Evaluate the following expressionsa, b integers, c float, d double, i, j intergers
i. a/b*c-b+a*d/3
ii. j = (i++) + (++i)
b. Square root of a given number.
c. Find the area of circle, square, rectangle and triangle.
d. Find the maximum of three numbers using conditional operator.
e. Take marks of 5 subjects in integers, find the total in integer and average in float.
4. Exercise – 4: Conditional Statements
a. Conditional statements in C.
Objective: Understand if and else.
[Link]
c/problem?isFullScreen=true
b. Roots of a Quadratic Equation.
c. Generate electricity bill.
d. Simulate a calculator using switch case.
e. Find the given year is a leap year or not, year should be YYYY.
5. Exercise – 5: Loops
a. “for” Loop in C.
Objective: Learn the usage of the for loop.
[Link]
b. Sum of the digits of a 5-digit number.
Objective: Learn the usage of while loop and usage of operators - % and /.
[Link]
number/problem?isFullScreen=true
c. Given number is a prime or not. (Also Prime numbers between a given range.)
d. Armstrong Number or not.
e. Palindrome or not.
f. Printing patterns using Loops.
Objective: Print a pattern of numbers.
[Link]
2/problem?isFullScreen=true
g. Construct a Pascal triangle
6. Exercise – 6: Arrays
a. One dimensional Arrays in C
Objective: Print the sum and free the memory where the array is stored.
[Link]
Aditya College of Engineering (A) 4
ACOER23 I
b. Array reversal
Objective: Working with indices in array
[Link]
c. Search an element in array (Linear Search)
d. Find min and max elements in array
e. Replace an element into array at a given index
f. Identify duplicate elements from array
g. Sorting of elements in an array using Bubble sort
7. Exercise – 7:2-D Arrays
a. Addition of two matrices
b. Multiplication of two matrices
c. Transpose of a Matrix
d. Trace of a Matrix
e. Lower Triangular in a Matrix
8. Exercise – 8: Strings
a. Printing Tokens
Objective: print each word of the sentence in a new line
[Link]
/problem?isFullScreen=true
b. Count number of alphabets (lowercase, uppercase, consonants, vowels) and digits
c. Lowercase to Uppercase, Uppercase to Lowercase, Toggle case, Sentential case
d. Digit Frequency
Objective: find the frequency of each digit in the given string.
[Link]
1/problem?isFullScreen=true
e. Find string length, concatenate two strings, reverse a string using built-in and without
built-in string functions.
9. Exercise – 9: Functions and Recursion
a. Functions in C
Objective: Learn simple usage of functions.
[Link]
b. Fibonacci Numbers using recursion
Objective: Complete the recursive function.
[Link]
c. Factorial
Objective: N! (N factorial) using recursion.
[Link]
ende/challenges/factorial-using-recursion-1
d. Digit Sum
Objective: find the super digit of the integer.
[Link]
e. LCM
f. Calculate the Nth term
Aditya College of Engineering (A) 5
ACOER23 I
Objective: Find the Nth term.
[Link]
10. Exercise – 10: Pointers
a. Pointers in C
Objective: learn to implement the basic functionalities of pointers in C.
[Link]
b. Students Marks Sum
Objective: Learn using Pointers with Arrays and Functions
[Link]
sum/problem?isFullScreen=true
c. Sorting Array of Strings
Objective: sort a given array of strings into lexicographically increasing order or into
an order in which the string with the lowest length appears first.
[Link]
strings/problem?isFullScreen=true
d. Find the sum of a 1D array using malloc()
e. Swap two numbers using functions and pointers - call by value and reference.
f. Dynamic Array in C
Objective: Handling requests by a Librarian to place the books in the shelves.
[Link]
c/problem?isFullScreen=true
11. Exercise – 11: Structure, Union, typedef, bit-fields and enum
a. Write a C program to find the total, average of n students using structures
b. Boxes through a Tunnel
Objective: Using a structure for transporting some boxes through a tunnel
[Link]
c. Post Transition
Objective: Storing and transferring packages using pointers in structures.
[Link]
d. Copy one structure variable to another structure of the same type.
e. Read student name and marks from the command line and display the student details
along with the total.
f. Shift/rotate using bitfields.
12. Exercise – 12: Files
a. Write text into and read text from a file
b. Write into text and read text from a binary file using fread() and fwrite()
c. Copy the contents of one file to another file.
d. Merge two files into the third file using command-line arguments.
Aditya College of Engineering (A) 6
ACOER23 I
13. Exercise – 13: Logic Building – Augmented Experiments (Complete any 2)
a. Variadic functions in C
Objective: Understanding variable number of arguments
[Link]
c/problem?isFullScreen=true
b. Querying the Document
Objective: representing the words, sentences, paragraphs, and documents using
pointers.
[Link]
document/problem?isFullScreen=true
c. Structuring the Document
Objective: Using structure with pointers
[Link]
document/problem?isFullScreen=true
d. Small Triangles, Large Triangles
Objective: Print sorted by their areas
[Link]
triangles/problem?isFullScreen=true
e. Permutations of Strings
Objective: print all strings permutations in strict lexicographical order
[Link]
strings/problem?isFullScreen=true
Textbooks:
1. Programming for problem solving using C Behrouz A. Forouzan. Richard F. Gilberg.
2. Programming in C, Rema Theraja , Oxford, 2016, 2nd edition
3. Unix Shell Programming, Kanetkar Yeshvant P, BPB Publications
Aditya College of Engineering (A) 7