C Programming Lab Manual
C Programming Lab Manual
C Programming Lab Manual
WORKSHEET-1
CLASS: 1/4 B-TECH
SUBJECT: C Programming language
------------------------------------------------------------------------------------------------------------1. Write a program to display a line of text.
2. Write a program to display different types of data (integer, real, character).
3. Write a program to read two values and print their sum and difference .
4. Write a program to read two real values and perform all arithmetic operations
5. Write a program to compute the average of three integers and three real numbers.
6. Write a program to display the area and circumference of circle by reading the radius .
7. Write a program to find the area and perimeter of the following :
a) square
b) rectangle c) triangle.
8.Write a program to read the temperature in Fahrenheit (F0) and display it in centigrade.
9. Write a program to convert the time from hours to seconds.
10. Write a program to read two values in two variables and interchange their values using a third
variable.
11.Write a program to find simple interest and compound interest for certain period of time
reading the values of principal amount(P),time(T),and rate of interest(R).
12.Write a program to find the net salary for a given data:
Earnings:
D.A-----35%BASIC
H.R.A------15%BASIC.
Deductions: I.T-------10%BASIC
P.F---------5%BASIC.
13. Write a program to input the time in seconds and display it in hours , minutes and seconds .
14. Write a program to convert the given number of days into years ,months and days .
15. Write a program to read the roll number and three subject marks of a student and calculate
average marks .
16. Write a program to calculate the following by reading necessary values from the user.
a)ax+b/ax-b
b)2.5logx+cos32+|x2-y2|+2xy
c)(x2+y2-2xy)
d)ut+1/2at2
17. Write a program to print the ASCII values of the given character and vice versa.
18. Write a program to read an integer value using character variable and vice versa.
19. Write a program to input the character in upper case and convert it into lowercase.
20. Write a program to display hexadecimal and equivalent decimal numbers.
SUBJECT:C-Programming language
13. A cloth show room has announced the following seasonal discounts on purchase items.
Purchase Amount
discount
Mill cloth
handloom
0-100
-5%
101-200
5%
7.5%
201-300
7.5%
10%
Above 300
10%
15%
Write a program to compute the net amount to paid by the customer.
14.Write a program to that reads a decimal digit and display its corresponding binary value
using SWITCH statement.
15.Write a program that reads three vertices of a triangle and find the lengths of the sides and
print the type of the triangle (isosceles,equilateral ,scalene).
16.Write a program to caliculate x1=(md-nb)/(ad-bc), x2=(na-mc)/ad-bc) when ad-bc!=0
otherwise print error message.
17.Write a program to caliculate y=4x+100 if x<0, y=300 if x=40,y=4.5x+150 if x>40 using
conditional operator and if.
18.Write a program that reads values until you enter a negative value and display max and min
value.
19.Write a program to print image of the given number .
20.Write a program to compute the square root for 5 positive numbers.
SUBJECT:C-Programming language
SUBJECT:C-Programming language
3.
4.
5.
6.
SUBJECT:C-Programming language
10. Write a program to check whether the given integer is palindrome or not.
11. Write a program to find the second largest of the given number.
SUBJECT:C-Programming language
1. Given the array of elements, print the elements in the reverse order 2 per line.
2. A one dimensional array A contains at most 25 elements. Form a new array B with
intermediate elements being revaluated according to the formula
B(i)=1/3*(A[i-1]+A[i]+A[i+1]; print the elements of B three per line.
3. Two given arrays N1 and N2 each contains different positive integers, write a program to
find the common elements in N1 and N2 and print them
4. An array contains a max. no. of 25 elements each b/w 1s and 10.Write a program to find
how many 1s , 2s and 10s are there.
5. Write a program to find the largest and smallest in the given array of n elements.
6. Write a program to read a set of floating values terminated by 99 and print the avg and
print the number of values below avg.
7. Write a program that checks whether the given string is palindrome or not.
8. Write a program that reads a set of integers removes the duplicates and prints them.
SUBJECT:C-Programming language