0% found this document useful (0 votes)
18 views4 pages

C Programming Lab Exercises Guide

The document outlines a computer programming laboratory curriculum focused on C programming exercises. It includes exercises on basic programming concepts, data types, decision statements, loops, arrays, functions, and string manipulation. Each exercise consists of multiple tasks aimed at enhancing programming skills through practical coding challenges.

Uploaded by

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

C Programming Lab Exercises Guide

The document outlines a computer programming laboratory curriculum focused on C programming exercises. It includes exercises on basic programming concepts, data types, decision statements, loops, arrays, functions, and string manipulation. Each exercise consists of multiple tasks aimed at enhancing programming skills through practical coding challenges.

Uploaded by

rohitbolla1231
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Computer programming laboratory

Exercise 1: To demonstrate the use of Dev C++ IDE. Writing and


compiling simple c program.

1. Simple C program to type Hello word.


2. Print student’s name.
3. Print multiple lines.
4. Enter value from keyboard and print.

Exercise 2: Writing and compiling C programs using various data


types, operators and expressions.

1. Write a program to interchange the value given to two variables.


(Using third variable or without using third variable).
2. Write a program to find simple interest.
3. Write a C program to perform addition, subtraction, division and
multiplication of two numbers.
4. Write a program to take input of name, roll no and marks obtained by a
student in 3 subjects of 100 marks each and display the name, roll no
with percentage score secured.
5. Write a Program to calculate and display the volume of a CUBE having
its height (h=10cm), width (w=12cm) and depth (8cm).
6. C Program to calculate Gross Salary. In this program we will take basic
salary as an input and on the basis of following calculation we calculate
gross salary.
da is 5% of basic salary
hra is 10% of basic salary
Gross Salary = basic salary + da + hr
7. Write a C program that accepts an employee's ID, total worked hours
in a month and the amount he receives per hour. Print the ID and
salary (with two decimal places) of the employee for a particular
month.
8. Write a C program to perform an average of three numbers.

Exercise 3: Writing and compiling c programs using Decision


Statements (if, if-else, if-else-if ladder, switch)

1. Write a C program to check whether the given number is even or odd.


2. Write a C program to find maximum between two numbers.
3. Write a C program to check whether a number is divisible by 5 and 11
or not.
4. Write a C program to check whether a number is negative, positive or
zero.

Student no.: Div. & Batch:


Computer programming laboratory

5. Write a C program to input week number and print weekday (use


switch case).
6. Write a C program to input month number and print number of days in
that month.
7. Write a C program to find maximum between three numbers. (nested if
else).
8. Write a C program to make simple calculator. (switch case)
9. The marks obtained by a student in 5 different subjects are input
through the keyboard. The student gets a division as per the following
rules: Percentage above or equal to 60 - First division
Percentage between 50 and 59 - Second division
Percentage between 40 and 49 - Third division
Percentage less than 40 - Fail
Write a program to calculate the division obtained by the student.(if-
elseif-ladder)
10. In a company an employee is paid as under:
11. If his basic salary is less than Rs. 1500, then HRA = 10% of basic
salary and DA = 90% of basic salary. If his salary is either equal to or
above Rs. 1500, then HRA = Rs. 500 and DA = 98% of basic salary. If
the employee's salary is input through the keyboard write a program to
find his gross salary.

Exercise 4: Writing and compiling c programs using Loop & nested


loop Statements (for, while, do-while)

1. Write a program to find the sum of first N natural numbers.


2. Write a program to find factorial of given no.
3. Write a program to show Fibonacci series for first N nos.
Hint: 1 1 2 3 5 8 13.
4. Write a program to find whether a number is palindrome or not.
5. Write a program that displays multiplication table of given no.
The table should get displayed in the following form.
29 * 1 = 29
29 * 2 = 58
……
6. Write a program to find whether the number is Armstrong or not.
7. Write a program to reverse digits of entered number.

Student no.: Div. & Batch:


Computer programming laboratory

8. Write a program to print the following patterns:


* * *****
* * *** ****
* ** ***** ***
* *** ******* **
* **** ******** *
*

* 1 1
***
23 1 1
*****
******* 456 1 2 1
*********
7 8 9 10 1 3 3 1
*******
***** 11 12 13 14 1 4 6 4 1
***
15
*

Exercise 5: Writing and compiling c programs using Arrays.

1. Write a program to read and display n numbers using an array.


2. Write a program to accept 10 numbers in an array. Also calculate and
print sum of those numbers.
3. Write a program to accept 5 numbers in an array and find out the
maximum and minimum number out of those.
4. Write a program to accept marks for three subjects of five students.
Calculate and print, percentage of each student, highest marks in each
subject and avg marks of each subject.
5. Write a program to accept a matrix from the user and print the sum of
all elements.
6. WAP to enter a 4 X 4 matrix from user and obtain sum of individual
rows and individual columns also calculate sum of diagonal elements.
Exercise 6: Writing and compiling c programs using Functions.

1. Write a program to prepare the function to add first N numbers.

Student no.: Div. & Batch:


Computer programming laboratory

2. Write a function to find factorial of a number using recursion and


without recursion.
3. Write a calculator program (add, subtract, multiply and divide).
Prepare user defined function for each functionality.
4. 5-digit positive integer is entered through the keyboard,
write a function to calculate sum of digits of the 5-digit number:
(1) Without using recursion
(2) Using recursion

5. Write a recursive function to obtain the first 25 numbers of a Fibonacci


sequence. In a Fibonacci sequence the sum of two successive terms
gives the third term. The following are the first few terms of the
Fibonacci sequence:
1 1 2 3 5 8 13 21 34 55 89...

Exercise 7: Writing and compiling c programs using String.

1. Write a program to copy one string into another string.


Note: - 1) with using strcpy () 2) without using strcpy ()
2. Write a program to compare two strings.
3. Write a program to reverse a given string.
4. Write a program that converts all lowercase characters in a given
string to its equivalent uppercase character.
5. Write a program to find a character, replace, and delete a character
from given string.

Student no.: Div. & Batch:

You might also like