0% found this document useful (0 votes)
120 views10 pages

Lab Programs 1 - 10

The document outlines 10 programming labs with C programming problems to solve. Lab 1 involves basic arithmetic, unit conversions, and calculating averages. Lab 2 covers finding maximums, checking leap years, and determining weekdays. Later labs involve arrays, strings, matrices, functions, recursion, pointers, structures, and file operations. The document provides detailed problems for students to practice programming concepts.

Uploaded by

Ayush Kumar
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)
120 views10 pages

Lab Programs 1 - 10

The document outlines 10 programming labs with C programming problems to solve. Lab 1 involves basic arithmetic, unit conversions, and calculating averages. Lab 2 covers finding maximums, checking leap years, and determining weekdays. Later labs involve arrays, strings, matrices, functions, recursion, pointers, structures, and file operations. The document provides detailed problems for students to practice programming concepts.

Uploaded by

Ayush Kumar
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/ 10

Subject: Programming for Problem Solving Lab

Programs for Lab 1

1. Write a C program to enter two numbers and perform all arithmetic operations.

2. Write a C program to enter length in centimeter and convert it into meter and kilometer.

3. Write a C program to enter temperature in °Celsius and convert it into °Fahrenheit.

4. Write a C program to enter marks of five subjects and calculate total, average and percentage.

5. Write a C program to enter P, T, R and calculate Simple Interest.

6. Write a C program to enter P, T, R and calculate Compound Interest.


Subject: Programming for Problem Solving Lab
Programs for Lab 2

1. Write a C program to find maximum between three numbers.


2. Write a C program to check whether a year is leap year or not.
3. Write a C program to input any character and check whether it is alphabet, digit or special character.
4. Write a C program to input week number and print weekday.
5. Write a C program to check whether the triangle is equilateral, isosceles or scalene triangle.
6. Write a C program to find all roots of a quadratic equation.
7. Write a C program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and
8. Computer. Calculate percentage and grade according to following:
Percentage >= 90% : Grade A
Percentage >= 80% : Grade B
Percentage >= 70% : Grade C
Percentage >= 60% : Grade D
Percentage >= 40% : Grade E
Percentage < 40% : Grade F
9. Write a C program to input basic salary of an employee and calculate its Gross salary according to following:
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary <= 20000 : HRA = 25%, DA = 90%
Basic Salary > 20000 : HRA = 30%, DA = 95%
10. Write a C program to input electricity unit charges and calculate total electricity bill according to the given
condition:
For first 50 units Rs. 0.50/unit
For next 100 units Rs. 0.75/unit
For next 100 units Rs. 1.20/unit
For unit above 250 Rs. 1.50/unit
An additional surcharge of 20% is added to the bill
Subject: Programming for Problem Solving Lab

Programs for Lab 3

1. Write a C program to find sum of all natural numbers between 1 to n.


2. Write a C program to calculate sum of digits of any number.
3. Write a C program to enter any number and print its reverse.
4. Write a C program to enter any number and calculate its factorial.
5. Write a C program to check whether a number is Prime number or not.
6. Write a C program to check whether a number is Armstrong number or not.
7. Write a C program to print Fibonacci series up to n terms.
8. Write a C program to print the following pattern :
*
**
***
****
*****

9. Write a C program to print the following :


1
12
123
1234
12345

10. Write a C program to print the following :


54321
4321
321
21
1
Subject: Programming for Problem Solving Lab

Programs for Lab 4

1. Write a C program to find sum of all array elements.


2. Write a C program to find maximum and minimum element in an array.
3. Write a C program to search an element in an array.
4. Write a C program to sort an array elements in ascending order using bubble sort.
5. Write a C program to sort an array elements in ascending order using selection sort.
6. Write a C program to print the length of a string.
7. Write a C program to find reverse of an array(string).
8. Write a C program to copy string from one array to an another array.
Subject: Programming for Problem Solving Lab

Programs for Lab 5

1. Write a C program to add two matrices.


2. Write a C program to subtract two matrices.
3. Write a C program to multiply two matrices.
4. Write a C program to find sum of main diagonal elements of a matrix.
5. Write a C program to sort the names of five students.
Subject: Programming for Problem Solving Lab

Programs for Lab 6

1. Write a C program to find cube of any number using function.


2. Write a C program to find maximum and minimum between two numbers using functions.
3. Write a C program to find all prime numbers between given interval using functions.
4. Write a C program to print all Armstrong numbers between given interval using functions.
5. Write a C program to print factorial of given number using functions
Subject: Programming for Problem Solving Lab

Programs for Lab 7

1. Write a C program to print all natural numbers between 1 to n using recursion.


2. Write a C program to find sum of all natural numbers between 1 to n using recursion.
3. Write a C program to find factorial of any number using recursion.
4. Write a C program to generate nth Fibonacci term using recursion.
Subject: Programming for Problem Solving Lab

Programs for Lab 8

1. Program to create, initialize, assign and access a pointer variable.


2. Program to swap two numbers using pointers.
3. Program to read array elements and print with addresses.
4. Program to demonstrate example of double pointer (pointer to pointer).
Subject: Programming for Problem Solving Lab

Programs for Lab 9

1. C program to read and print an employee's detail using structure.


2. Create a structure student to store the name, roll no and percentage of the student. Enter
some sample values within the structure and print the details of the student with
maximum marks C program to demonstrate example structure pointer (structure with
pointer).
3. Create a structure book with the elements name, price, and pages. Write a C Program to
store display data of 100 books.
4. C program to add two distances in feet and inches using structure.
Subject: Programming for Problem Solving Lab

Programs for Lab 10

1. C Program to Find the Number of Lines in a Text File.


2. C Program to Convert the Content of File to Uppercase/lowercase.
3. C Program to Count No of Lines, Blank Lines, Comments in a given Program.
4. C Program to Reverse the Contents of a File and Print it.
5. C Program to Copy the content of one file to another file.

You might also like