Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views3 pages

Lab Assignments

The document outlines a series of lab experiments for programming in C, covering various topics such as basic input/output, arithmetic operations, conditional statements, and data structures. Each experiment includes specific tasks that require writing C programs to perform calculations, conversions, and data manipulations. The experiments progress from simple programs to more complex ones involving arrays, matrices, and file handling.

Uploaded by

ojasverma.pace
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)
4 views3 pages

Lab Assignments

The document outlines a series of lab experiments for programming in C, covering various topics such as basic input/output, arithmetic operations, conditional statements, and data structures. Each experiment includes specific tasks that require writing C programs to perform calculations, conversions, and data manipulations. The experiments progress from simple programs to more complex ones involving arrays, matrices, and file handling.

Uploaded by

ojasverma.pace
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/ 3

FOCP LAB ASSIGNMENT

1) LAB Experiments 1.
a. Write a program to print your name, scholar number and branch name on the screen.
b. write a c program to declare and initialize two integer variable and perform arithmetic operation like addition
subtraction multiplication and division.
c. write a c program to calculate area & circumference of the circle using the radius. The radius a circle is input
through the keyboard.
d. write a program to calculate the area & perimeter of the rectangle. The length & breadth of a rectangle are
input through the keyboard.
e. write a c program to convert money in rupee by given amount in dollar. Money in dollar is input through the
keyboard.
f. write a c program to convert temperature given in Fahrenheit to centigrade. Temperature of a city in Fahrenheit
degrees is input through the keyboard.

2) LAB Experiments 2.
a. write a c program to calculate simple interest of given amount, rate of interest and time. Amount, rate of
interest and time are input through the keyboard.
b. Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house
rent allowance is 20% of basic salary. Write a program to calculate his gross salary.
c. The distance between two cities (in km.) is input through the keyboard. Write a program to convert and print
this distance in meters, feet, inches and centimetres.
d. If the marks obtained by a student in five different subjects are input through the keyboard, find out the
aggregate marks and percentage marks obtained by the student. Assume that the maximum marks that can be
obtained by a student in each subject is 100.
e. Two numbers are input through the keyboard into two locations C and D. Write a program to interchange the
contents of C and D.
f. If the total selling price of 15 items and the total profit earned on them is input through the keyboard, write a
program to find the cost price of one item.

3) LAB Experiments 3.
a. write a c program that will take a numeric number and convert it into ASCII CODE.
b. If a five-digit number is input through the keyboard, write a program to calculate the sum of its digits.
c. If a five-digit number is input through the keyboard, write a program to reverse the number.
d. In a town, the percentage of men is 52. The percentage of total literacy is 48. If total percentage of literate men
is 35 of the total population, write a program to find the total number of illiterate men and women if the
population of the town is 80,000.
e. A cashier has currency notes of denominations 10, 50 and 100. If the amount to be withdrawn is input through
the keyboard in hundreds, find the total number of currency notes of each denomination the cashier will have to
give to the withdrawer.
f. If a five-digit number is input through the keyboard, write a program to print a new number by adding one to
each of its digits. For example, if the number that is input is 12391 then the output should be displayed as
23402.
4) LAB Experiments 4.
a. Write a C program to find the maximum in the given two numbers using the conditional operator.
b. Write a C program to find the given number is
I. positive or negative
II. odd or even
c. Write a C program to find that a person is eligible for voting or not, If the given number is showing their age.
d. Write a C program to enter two numbers x and y. Make a comparison between them with the conditional
operator. If the first number is lower than the second, perform a modulo operation as x%y otherwise
multiplication operation as x*y and print the final output.
e. Write a C program to find the largest among three user given numbers using the conditional operator.
f. Write a C program to find the given year is leap year or not a leap year using the conditional operator.
5) LAB Experiments 5.
a. Write a program to determine whether the year is leap or not. Any year is entered through the keyboard. Use
the logical operators && and ||.
b. Write a C program to enter any character using keyboard and check using ASCII values that
I. whether a character is vowel or consonant.
II. whether a character is uppercase or lowercase.
III. if the user enters other than character then check that is it is digit or special character?
c. Write a C program to enter all three angles of a triangle and check whether triangle is valid or not.
I. if triangle is valid then also check whether it is right, acute or oblique.
II. if triangle is valid then also check whether is equilateral, scalene or isosceles.
o A triangle is said to be a valid triangle if and only if sum of its three angles is 180 °
o If a, b, c are three angles of triangle. Then, A triangle is right only if any of one angle is 90.
o A triangle is acute only if all angles are less than 90.
o A triangle is oblique only if any of one angle is more than 90.
o A triangle is valid if sum of its two sides is greater than the third side.
o A triangle is equilateral only if x == y == z. If x, y, z are three sides of triangle.
o A triangle is said Isosceles Triangle, if it’s any of two sides are equal.
o A triangle is said Scalene Triangle, if none of its sides are equal.
d. Q.4 Write a C program to enter values of a, b, c of quadratic equation (aX^2 + bX + c = 0) and find all roots of
a quadratic equation.
o Discriminant (D) of the given quadratic equation = (b*b) - (4*a*c).
o If D > 0 then, root1 = (-b + sqrt(D)) / (2*a) and root2 = (-b - sqrt(D)) / (2*a).
o If D == 0 then, root1 = root2 = -b / (2*a).
o if D < 0 then, Imaginary: root1 = -b / (2*a) and root2 = -b / (2*a).]
o sqrt(): square root function which comes from <math.h>
e. Write a C program to enter electricity unit and calculate total electricity bill according to the given conditional
charges: For first 40 units Rs. 0.65/unit, For next 80 units Rs. 0.85/unit, For next 80 units Rs. 1.35/unit, For
unit above 200 Rs. 1.95/unit, An additional surcharge of 25% is added to the bill.
f. Write a C program to input basic salary of an employee and calculate its Gross salary according to following:
o if Basic <= 12000 then HRA = 18% of Basic, DA = 75% of Basic
o if Basic <= 25000 then HRA = 28% of Basic, DA = 85% of Basic
o if Basic > 25000 then HRA = 35% of Basic, DA = 93% of Basic
o Gross=Basic + HRA + DA

6) LAB Experiments 6.
a. Write a C program to find number of digits in a given number. The number is input through the keyboard.
b. Write a C program to find sum of digit in a given number. The number is input through the keyboard.
c. Write a C program to reverse number of a given number. The number is input through the keyboard.
d. Write a C program to find factorial of a given number. The number is input through the keyboard.
e. Write a C program to find Fibonacci series up to a given number. The number is input through the keyboard.
f. Write a C program to check whether a user given number is Armstrong number or not.
g. Write a C program to swap first and last digit of a number.

7) LAB Experiments 7.
a. Write a C program to find the sum of sin(x) series. x is input through the keyboard.
b. Write a C program to find the value of ab using for loop. a, b is input through the keyboard.
c. Write a C program to check whether the number (n) is palindrome or not.
d. Write a C program to calculate compound Interest for user given amount, time and rate of interest.
e. Write a C program to find the lcm and hcf for two number (x,y) given by user keyboard.
f. Write a C program to find the gcd for two number (x,y) given by user keyboard.
8) LAB Experiments 8. Write a C program to print the following pattern.

a. patter b. c.
____1 __ __A *********
___21 _ __BAB _*******
__321 _ _CBABC __*****
_4321 _DCBABCD ___***
54321 EDCBABCDE ____*
d. e. f. Pascal’s triangle.
ABCDEFEDCBA ********* _____ 1__ _ _ _
ABCDE EDCBA * * ____1_ 1_ _ _ _
ABCD DCBA * * ___1_ 2_ 1_ _ _
ABC CBA * * __1_ 3_ 3_ 1_ _
AB BA ********* _1_4_ 6 _ 4 _1_
A A * 1 _ 5 _ 10 _ 10 _ 5 _ 1
*
9) LAB Experiments 9.
a. Write a C program to find factorial of a number using function (iterative) and recursive function.
b. Write a C program to find number of digits in a number using function (iterative) and recursive function.
c. Write a C program to find sum of digits of a number using function (iterative) and recursive function.
d. Write a C program to reverse of a number using function (iterative) and recursive function.
e. Write a C program to find Fibonacci series for n terms using function (iterative) and recursive function.
f. Write a C program to find power (ab) using function (iterative) and recursive function.

10) LAB Experiments 10.


a. Write a program to find sum and average of array of 20 elements.
b. Write a program to find sum of all element of even position of an array of 20 elements.
c. Write a program to find largest and smallest number of array of array of 20 elements.
d. Write a program to find an array which is reverse of given array.
e. Write a program to find frequency of each element of an array.
f. Write a program to search a number in the array. If it is present, display its position in the array.

11) LAB Experiments 11.


a. Write a program to find the largest number from 5 x 5 matrix (matrix of 5 row by 5 column).
b. Write a program to multiply any two matrices. take size of matrix and cell values using keyboard .
c. Write a program to find if a square matrix is (a) symmetric or not, (b) identify or not , idempotent
d. Write a program that converts all lowercase characters in a given string to its equivalent uppercase character.
e. Write a program that replaces two or more consecutive blanks in a string by a single blank.
f. Write a program to sort a set of names stored in an array in alphabetical order.

12) LAB Experiments 12.


a. Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of
joining. Assume that there are not more than 50 students in the collage.
I. Write a function to print the data of a student whose roll number is given.
II. Write a function to print names of all students who joined in a particular year.
b. Write a program in C to store n elements in an array and print the elements using pointer.
c. Write a program in C to demonstrate the use of &(address of) and *(value at address) operator using pointer.
d. Write a program in C to swap elements using call by reference.
e. Find the sum of n numbers entered by user using dynamically allocated memory using C programming.
f. Write a program in C to create and store information in a text file. Also Find the Number of Lines in a Text
File.

You might also like