0% found this document useful (0 votes)
65 views3 pages

2CS101 Detailed List of Practicals

This document contains a list of 8 experiments for a Computer Programming course. The experiments cover topics including: 1) Writing simple C programs using CodeBlocks IDE 2) C programs demonstrating operators, conditional statements, loop constructs, arrays, strings, functions, and structures 3) Examples include programs to calculate employee salary, find roots of a quadratic equation, sort strings, and calculate item costs The goal is for students to practice and demonstrate mastery of basic C programming concepts and techniques through these hands-on assignments.

Uploaded by

star lord
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views3 pages

2CS101 Detailed List of Practicals

This document contains a list of 8 experiments for a Computer Programming course. The experiments cover topics including: 1) Writing simple C programs using CodeBlocks IDE 2) C programs demonstrating operators, conditional statements, loop constructs, arrays, strings, functions, and structures 3) Examples include programs to calculate employee salary, find roots of a quadratic equation, sort strings, and calculate item costs The goal is for students to practice and demonstrate mastery of basic C programming concepts and techniques through these hands-on assignments.

Uploaded by

star lord
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Nirma University

Institute of Technology
B.Tech. Semester I (CSE, EC and IC)
2CS101 Computer Programming
List of Experiments

Sr. List of Experiments Mapped


No. COs
1. Introduction to CodeBlocks IDE, Writing and compiling a simple C program
a. Introduction to CodeBlocks IDE. Use CodeBlocks to write and compile a simple C
program (“Hello World”).
b. Write C programs: 1
i. To scan and print values of different types of variables
ii. To print address of a variable
iii. To demonstrate different escape sequences
2 C programs to demonstrate various operators
Write C programs for the following:
a. To scan two numbers and display result of different arithmetic operations (+, -, *,
/ and %)
b. A company has following scheme for payment to their staff.
• Net salary = Gross salary – Deduction
• Gross salary = Basic + DA + HRA + Medical
• Deduction = Insurance + PF
• DA (Dearness allowance) = 50% of Basic
• HRA (House rent allowance) = 10% of Basic
• Medical = 4% of Basic
• PF (Provident Fund) = 5% of Gross
• Insurance = 7% of Gross 1,2,3
Calculate the net payment to any employee.
c. The driver is driving a car from city Ahmedabad to city Mumbai, in Ahmedabad
temperature displays in Celsius while in Mumbai the temperature displayed in
Fahrenheit, a driver wants to find the difference between the temperatures of two
cities in Celsius.
d. To calculate simple interest.
e. A boy was punished and asked to cover 5 rounds of the circular ground. Area of
the ground is 32000 sq mtr. Calculate how many kilometres the boy has covered.
f. Read the price of item in decimal form. For example, 12.52 and separate rupee
and paise from the given value. For example, 12 rupees and 52 paise.
g. To swap the value of two numbers (i) using and (ii) without using a temporary
variable.
h. To find greatest of two and three numbers using the ternary operator.
3 C programs to demonstrate use of conditional statements
Write C programs for the following:
a. Write a program to take the values for A, B, C of a quadratic equation
A∗X2+B∗X+C=0 and then find all the roots of the equation. It is guaranteed that A
≠ 0 and that the equation has at least one real root.
b. Write a C program to make a simple calculator using the following:
i. if…else if
ii. switch-case
c. In an organization, employees are paid on hourly basis. Clerks are paid 100/hr,
Teachers are paid 200/hr and Principal is paid 400/hr. If the weekly hours 1,2,3
exceed 44, then employee should be paid 2 times their regular pay for the
overtime. Write a C program to compute the weekly salary of the employee and
also the program should take care that the employee should not be paid for hours
beyond 50 in a week. Use best suitable control construct to implement the
program.
d. Ajay and Amit are playing a game with a number X. In one turn, they can
multiply X by 2. The goal of the game is to make X divisible by 10. Write a C
program to find the number of turns necessary to win the game (it may be
possible to win in zero turn, 1 turn or it might be impossible (-1 turns)).
e. Write a program to implement a simple number guessing game. Program should
generate an integer randomly and ask the user to guess the integer. Based on the
number guessed, it should display the appropriate message (correct or
incorrect).
f. Write a C program to find the grade of a student based on the following policy.
Class test: 12% weightage, Tutorial-12%, SE:16%, LPW:20%, SEE:40%.
Grade is decided based on the below range of total marks.
Grade Range of total marks
A+ 91-100
A 81-90
B+ 71-80
B 61-70
C+ 51-60
C >40
Fail <40
4 C programs to demonstrate use of loop constructs
Write C Programs:
a. To display following patterns:
A 1 1
AB 01 121
ABC 101 12321
ABCD 0101 1234321
1,2,3
b. To check whether the input number is an Armstrong number
c. To check whether the entered number is Prime
d. To check whether the entered number is Palindrome
e. Enhance the number guessing game developed earlier. The program should now
display more appropriate message (Greater, Smaller or Correct). It should allow
maximum 5 attempts from the user and still if the user cannot guess the number
correctly, it should display “Sorry”.
5 C programs based on arrays
a. Write a program
i. To read data from keyboard and store into 1-D array
ii. To read data from array and copy its square back to another array
iii. To reverse all elements of original array
iv. To find out maximum element of an original array and print its location
b. Write a program to delete an element from 1-D array.
c. Write a program that fills a 5 x 5 matrix with the following data: 1,2,3
i. Upper left triangle with -1
ii. Lower right triangle with 1
iii. Right to left diagonal with 0
Display the matrix on the screen.
d. Suppose that a class has 5 students. Each student study four subjects; CP, CS, Maths,
and Physics. Make a 2D array for the same. Write a C program
i. To find total marks in all subjects obtained by each student.
ii. To find average marks obtained by all 5 students in C programming subject.
6 C programs to explore String manipulation
Write C programs:
a. Write a program to delete a character entered by the user from the input string. All
occurrences of the input character should be deleted from the string.
b. Write a program to swap even positioned characters with odd positioned characters
in a given string.
c. Read a name from keyboard and find out how many times same character (case
1,2,3
insensitive) is repeating.
Example:
Input : Anand
Output : a is repeating two times, n is repeating two times
Input : Kunal
Output : None of the character are repeating.
d. Write a program to sort the strings entered by user as per dictionary order.
7 C programs to understand user defined function and parameter passing
a. Find union and intersection of two input integer arrays using user defined function.
The function should return the resultant array to the main function.
b. Consider a currency system in which there are notes of seven denominations, namely
Rs. 1, Rs. 2, Rs. 5, Rs. 10, Rs. 20, Rs. 50 and Rs. 100. A sum of Rs. N is entered as an
input. Write a function to compute the smallest number of notes that will combine to
give Rs. N. 1,2,3
c. Write a program to compute F(n) such that F(n) = 0, if n = 0, F(n) = 1, if n = 1, otherwise
F(n) = F(n - 1) + F(n - 2).
d. Aman has 10 balls that have different numbers on it and Shoaib has 6 balls. They both
arrange balls in all different possible ways. What is the ratio of number of
arrangements made by Aman to that made by Shoaib? Use recursive function to
calculate.
e. Perform Q 6c using user defined function.
8 C programs based on structures
a. Create a structure which holds various attributes (e.g. name, id, basic_salary, DA%,
HRA%, total_salary etc.) of an employee. Write a program which allows you to scan
these (except total_salary) attributes for 3 employees. The program should support
following operations:
i. Display (total salary of the selected employee)
ii. Max (find and display name of the employee with maximum salary)
b. Write a structure to accept item information such as name, quantity and unit price.
Structure should take information about 5 items. Create a user defined function that
calculates the cost of each item. Print details of each item such as:
Name Quantity Price Cost
Notebook 5 50.0 250.0
Pen Drive 2 500.0 1000.0
Pen 20 5.0 100.0
c. Write a structure for a complex number which has a real part and an imaginary part.
Add the 2 complex numbers, store it in another complex number using user defined
function and display the result as a complex number.
9 C programs to demonstrate use of pointers
a. Write a UDF using concept of pointers which can accept a one-dimensional array as an
argument. The function should add 1 to all odd element of the array and 2 to all even
elements of the array. The final array should be displayed by the main() function.
Repeat this program for two-dimensional array.
b. Write a function that swaps values of three numbers in a cyclic order and prints the
1,2,3
output from main function.
Example: a = 1, b = 2, c = 3 → Output: a = 3, b = 1, c = 2
c. Write a program to print array elements in reverse using pointer.
d. Write a UDF which accepts three strings as arguments. The function should
concatenate first two strings and keep the result in the third string which should be
displayed by the main() function.
10 C Programs for file processing
Write C Programs:
a. To calculate the length of a file 1,2,3
b. To concatenate two files
c. To copy content of one file in to another file

You might also like