0% found this document useful (0 votes)
107 views

C-Programming (For Civil Students) - Laboratory Programs: Lab - 1: Basic Programs-I

The document outlines 10 labs of programming exercises for a C programming course for civil students. Lab 1 includes programs to print personal details, calculate area of a circle, volume of a cylinder, simple interest, and convert temperatures. Lab 2 covers finding perimeter of a circle, calculating resistance of parallel resistors, and distance traveled given initial velocity and acceleration. Lab 3 focuses on operators for converting days to months/days, finding the greatest of 3 integers, and other exercises. Labs 4-5 cover decision making and branching/looping. Labs 6-8 assign pattern printing, array, and matrix exercises. Lab 9 works on strings. Lab 10 defines functions for calculating sums, factorials, finding maximums, exponents, and reversing strings.

Uploaded by

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

C-Programming (For Civil Students) - Laboratory Programs: Lab - 1: Basic Programs-I

The document outlines 10 labs of programming exercises for a C programming course for civil students. Lab 1 includes programs to print personal details, calculate area of a circle, volume of a cylinder, simple interest, and convert temperatures. Lab 2 covers finding perimeter of a circle, calculating resistance of parallel resistors, and distance traveled given initial velocity and acceleration. Lab 3 focuses on operators for converting days to months/days, finding the greatest of 3 integers, and other exercises. Labs 4-5 cover decision making and branching/looping. Labs 6-8 assign pattern printing, array, and matrix exercises. Lab 9 works on strings. Lab 10 defines functions for calculating sums, factorials, finding maximums, exponents, and reversing strings.

Uploaded by

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

C-Programming (For Civil Students) - Laboratory Programs

Lab - 1 : Basic Programs-I


1. Write a program to print your personal details (i.e name, age, city etc).
2. Write a program to find area of circle.
3. Write a program to volume of a cylinder.
4. Write a program to calculate simple interest.
5. Write a program to compute temperature in Fahrenheit from Centigrade.
6. Write a program to calculate final velocity of a vehicle at time 50 sec whose initial velocity is
5 m/s and acceleration is 1 m/s2.

Lab - 2 : Basic Programs-II


1. Write a program to find perimeter of a circle.
2. Two resistors are R1 and R2 are connected in parallel with each other. Write a program to
compute equivalent resistant Req of the circuit. (R1 and R2 values should be read by ‘scanf’
function.
3. Write a program to calculate the distance travelled by a car at time 45 sec, given the initial
velocity 10 m/s and acceleration 7 m/s2.
4. Write a program to compute average marks for a student of his marks in 5 subjects. Use
‘scanf’
Lab - 3 : C-Operators
1. Write a program to convert a given number of days into months and days.
2. Write a program to find out the greatest integer out of given three integers using ternary
operator.
3. Write a program to convert the distance from inches into feet and inches.
4. Write a program to find whether a given year is a leap year.
5. Write a program to obtain the following result: (x*(x+y)+(x-y))^1/3

Lab - 4 : Decision making and Branching


1. Write a program to find whether a given year is a leap year using ‘simple if else’.
2. Given the three sides of a triangle, write a program to find whether the triangle is right
angled or not using ‘simple if else’.
3. Write a program to find out the smallest integer out of given three integers ‘nested if else’.
4. Write a program to assign Grade to a student based on his total percentage using ‘elseif
ladder’.
5. Write a program to make simple calculator using ‘elseif ladder’.

Lab - 5 : Decision making and Looping


1. Write a program to read any five numbers and print the average value.
2. Write a program to find sum of digits of a given number.
3. Write a program to check whether given number is a prime number or not.
4. Write a program to calculate the following: 1! + 2! + 3! + …. + n!.
5. Write a program to find out Least Common Multiplier for two positive integers.
Lab - 6 : Patterns
Write a program to print the following Patterns.
1 5 a 1
12 44 bb 121
123 333 ccc 12321
1234 2222 dddd 1234321
12345 11111 eeeee

12345 11111 55555 1


1234 2222 4444 212
123 333 333 32123
12 44 22 4321234
1 5 1

Lab - 7 Arrays
1. Write a program to find maximum element from 1-D array.
2. Write a program to find number of odd and even elements from 1-D array.
3. Write a program to sort a given array in ascending order using bubble sort.
4. Write a program to delete an element from 1-D array.
5. Write a program to insert an element in 1-D array at specified place.
6. Write a program to remove duplicate elements from a given 1-D array

Lab - 8 : 2D Arrays
1. Write a program to print transpose of a matrix.
2. Write a program to count number of positive, negative and zero elements from 3x3 matrix.
3. Write a program to check whether a matrix is upper triangular matrix or not.
4. Write a program to print Pascal’s triangle using 2-D array.
5. Write a program to scan two matrices A and B and find A*B and |A+B|.
6. Write a program to check whether a matrix is symmetrical matrix or not.

Lab - 9 : Strings
1. Write a program to count number of words in a string.
2. Write a program replace a particular character in a string.
3. Write a program to toggle the characters in a given string.
4. Write a program to check whether a string is palindrome or not.
5. Write a program to append a string.

Lab - 10 : User Defined Functions


1. Write a function program to find sum of square of first ‘n’ numbers.
2. Write a function program to find factorial of a given number.
3. Write a function program to find maximum of 20 numbers.
4. Write a function program to find x^y.
5. Write a function program to reverse a string.

You might also like