0% found this document useful (0 votes)
22 views59 pages

CO101

This document is a practical file for a Programming Fundamentals course, detailing various programming exercises in C across ten labs. Each lab contains multiple problem statements focusing on different programming concepts such as input/output, arithmetic operations, control structures, arrays, strings, and functions. The document is submitted by a student, Mohammad Ayaan Abbas, to Dr. Rahul Gupta.

Uploaded by

sipojob866
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)
22 views59 pages

CO101

This document is a practical file for a Programming Fundamentals course, detailing various programming exercises in C across ten labs. Each lab contains multiple problem statements focusing on different programming concepts such as input/output, arithmetic operations, control structures, arrays, strings, and functions. The document is submitted by a student, Mohammad Ayaan Abbas, to Dr. Rahul Gupta.

Uploaded by

sipojob866
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/ 59

DEPARTMENT OF COMPUTER

SCIENCE AND ENGINEERING


PROGRAMMING FUNDAMENTAL
PRACTICAL FILE (CO)

SUBMITTED TO SUBMITTED BY
Dr Rahul Gupta Mohammad Ayaan Abbas
24/A13/015
1st Semester
INDEX
S.No Problem Statement Date Page Signature
No
LAB 1
1. Write a program in C to
understand the input and
output process.
2. Write a program to print an
integer and a float value.
3. Write a program to find the
sum, difference, multiplication,
division and average of two
numbers.
4. Write a program to find simple
interest.
LAB 2
1. Write a program to print the size
of different data types.
2. Write a program in C to print the
Area of circle when the radius of
circle is entered by the user.
3. Write a program to compute the
quotient and remainder when
dividend and divisor are given.
4. Write a C program to compute
the area and perimeter of a
rectangle with a height 7 inches
and width of 5 inches.
5. Write a C program to convert
the specified days into years,
weeks and days. Note: Ignore
leap year.

LAB 3
1. Write a program in C to check
whether the entered number is
prime or not.
2. Write a program in C to swap
two numbers.
3. Write a program in C to multiply
two floating point numbers
4. Write a program in C to print
the ASCII value of characters.
5. WAP to evaluate the sum of
a five-digit number.

LAB 4
1. Write a program in C to check
whether the entered number is
prime or not.
2. Write a program in C, take
student age as input. If his age
is greater than or equal to 18
then show the message “You are
eligible for voting” otherwise
show the message “You are not eligible for voting”.
3. WAP in C to evaluate the sum
of a five-digit number.

4. Write a program in C to check


entered number is even or odd.
5. Write a program to check whether
the input character is vowel or
consonant.

LAB 5
1. Write a program to find if the year
entered is leap year or not.
2. Write a C program to check whether
a triangle is equilateral, isosceles or
scalene by taking lengths as input
of three sides from the user.
3. Write a program to check whether
the character is an alphabet, digit
or special character.
4. Write a program in C to read any
month number in integer and display
month name in word. (Using switch case)
5. Write a program to input a number
and check positive, negative or
zero using switch case.

LAB 6
1. Write a C program to print sum of
Digits of a number entered by a
user using for/while/do while loop.
2. WAP in C to implement switch case.
3. WAP in C to find exponential function.

4. WAP in C to find the factorial of a


number using recursion.
5. Write a program to print the Fibonacci
series till the nth term.
6. WAP to convert decimal to binary
and vice versa. Decimal to binary:-

LAB 7
1. Write a C program to check given
number is palindrome or not.
2. Write a program to print triangle of
stars in C :
Full pyramid
Half pyramid
Inverted half pyramid
Inverted full pyramid
3. Write a C program to print hollow
mirrored inverted right triangle star
pattern series of n using for/ while/
do while loop.

LAB 8
1. Write a program to search an
element in an array using linear search.
2. Write a program to search an element
in an array using binary search.
3. Write a program to find the average of
n numbers using array.
4. Given an array write a program to left
rotate the elements of the array by one.
5. Write a program for addition of two 3*3
Matrices
6. Write a program for the multiplication of
two matrices.

LAB 9
1. Write a program to find the length of a
string without using strlen function.
2. Write a program to count the number
of vowels in a string.
3. Write a program to reverse a string and
check given string is palindrome or not.
4. Write a program to compare two strings
and concatenate them.
5. Write program to convert a string from
lowercase to uppercase and vice versa.

LAB 10
1. Write a program to swap two numbers
using pointer/call by reference.
2. WAP in C to find the factorial of a
number using recursion.
3. Write a program to find area of circle,
rectangle, square and triangle using
function.
4. Write a program to generate 10 employee
details using structure. Enter employee
name, department (HR, TECH, SERVICE),
salary and rating (1-5) from user. Update
the salary by adding a 10% increment if the
rating is 3 and more. Otherwise, add a 7%
increment. Count the number of employees
in HR department and print their details.
LAB 1
Q1) Write a program in C to understand the input and output
process.

OUTPUT :-

Q2) Write a program to print an integer and a float value.


OUTPUT:-

Q3) Write a program to find the sum, difference, multiplication,


division and average of two numbers.

OUTPUT:-
Q4) Write a program to find simple interest.

OUTPUT:-
LAB 2

Q1) Write a program to print the size of different data types.

OUTPUT:-
Q2) Write a program in C to print the area of circle when the
radius of circle is entered by the user.

OUTPUT:-

Q3) Write a program to compute the quotient and remainder


when dividend and divisor are given.
OUTPUT:-

Q4) Write a C program to compute the area and perimeter of a


rectangle with a height 7 inches and width of 5 inches.

OUTPUT:-
Q5) Write a C program to convert the specified days into years,
weeks and days. Note: Ignore leap year.

OUTPUT:-
LAB 3

Q1) Write a program in C to check whether the entered number


is prime or not.

OUTPUT:-
Q2) Write a program in C to swap two numbers.

OUTPUT:-

Q3) Write a program in C to multiply two floating point


numbers.
OUTPUT:-

Q4) Write a program in C to print the ASCII value of


characters.

OUTPUT:-
Q5) WAP to evaluate the sum of a five-digit number.

OUTPUT:-
LAB 4

Q1) Write a program in C to check whether the entered number


is prime or not.

OUTPUT:-
Q2) Write a program in C, take student age as input. If his age is
greater than or equal to 18 then show the message “You are
eligible for voting” otherwise show the message “You are not
eligible for voting”.

OUTPUT:-
Q3) WAP in C to evaluate the sum of a five-digit number.

OUTPUT:-

Q4) Write a program in C to check entered number is even or


odd.

OUTPUT:-
Q5) Write a program to check whether the input character is
vowel or consonant.

OUTPUT:-
LAB 5

Q1) Write a program to find if the year entered is leap year or


not.

OUTPUT:-
Q2) Write a C program to check whether a triangle is equilateral,
isosceles or scalene by taking lengths as input of three sides
from the user.

OUTPUT:-
Q3) Write a program to check whether the character is an
alphabet, digit or special character.

OUTPUT:-
Q4) Write a program in C to read any month number in integer
and display month name in word. (Using switch case)
OUTPUT:-
Q5) Write a program to input a number and check positive,
negative or zero using switch case.

OUTPUT:-
LAB 6

Q1) Write a C program to print sum of digits of a number


entered by a user using for/while/do while loop.

While loop:-

OUTPUT:-

For loop:-
OUTPUT:-

Do while loop:-
OUTPUT:-

Q2) WAP in C to implement switch case.

OUTPUT:-
Q3) WAP in C to find exponential function.

OUTPUT:-

Q4) WAP in C to find the factorial of a number using recursion.

OUTPUT:-
Q5) Write a program to print the Fibonacci series till the nth
term.

OUTPUT:-
Q6) WAP to convert decimal to binary and vice versa.
Decimal to binary:-

OUTPUT:-
Binary to decimal:-

OUTPUT:-
LAB 7

Q1) Write a C program to check given number is palindrome or


not.

OUTPUT:-
Q2) Write a program to print triangle of stars in C :
a. Full pyramid
b. Half pyramid
c. Inverted half pyramid
d. Inverted full pyramid

a. Full pyramid

OUTPUT:-
b. Half pyramid

OUTPUT:-
c. Inverted half pyramid

OUTPUT:-
d. Inverted full pyramid

OUTPUT:-
Q3) Write a C program to print hollow mirrored inverted right
triangle star pattern series of n using for/ while/ do while loop.

OUTPUT:-
LAB 8

Q1) Write a program to search an element in an array using


linear search.

OUTPUT:-
Q2) Write a program to search an element in an array using
binary search.

OUTPUT:-
Q3) Write a program to find the average of n numbers using
array.

OUTPUT:-
Q4) Given an array write a program to left rotate the elements
of the array by one.

OUTPUT:-
Q5) Write a program for addition of two 3*3 matrices

OUTPUT:-
Q6) Write a program for the multiplication of two matrices.
OUTPUT: -
LAB 9

Q1) Write a program to find the length of a string without using


strlen function.

OUTPUT:-
Q2) Write a program to count the number of vowels in a string.

OUTPUT:-
Q3) Write a program to reverse a string and check given string is
palindrome or not.

OUTPUT:-
Q4) Write a program to compare two string and concatenate
them.

OUTPUT:-
Q5) Write program to convert a string from lowercase to
uppercase and vice versa.

OUTPUT:-
LAB 10

Q1) Write a program to swap two numbers using pointer/call by


reference.

OUTPUT:-
Q2) WAP in C to find the factorial of a number using recursion.

OUTPUT:-
Q3) Write a program to find area of circle, rectangle, square and
triangle using function.

OUTPUT:-
Q4) Write a program to generate 10 employee details using
structure. Enter employee name, department (HR, TECH,
SERVICE), salary and rating (1-5) from user. Update the salary
by adding a 10% increment if the rating is 3 and more.
Otherwise, add a 7% increment. Count the number of
employees in HR department and print their details.
OUTPUT:-

You might also like