LAB Work (1)
LAB Work (1)
LAB Work-2
1. WAP to input a number and display it is odd or even.
2. WAP to input a number and display it is positive, negative or zero.
3. WAP to input two different numbers and display greatest.
4. WAP to input three different numbers and display smallest.
5. WAP to input three different numbers and display middle.
6. WAP to input marks in five subjects calculate total, percentage and division.
7. WAP to calculate sum, difference , product and division according to user choice using switch
case.
8. WAP to input length and breadth and height and calculate area, perimeter and volume
according to user choice
*********************Menu*******************
************A-> Calculate Area******************
************P->Calculate Perimeter**************
************V->Calculate Volume****************
************E->Exit***************************
9. WAP that inputs cost price(cp) and selling price (sp) and determine whether there is loss or gain.
10. WAP to calculate and display real roots of quadratic equation.(Hint check the condition(b 2-
4ac)>0 for real root)
11. WAP to find the commission amount on the basis of sales amount as per following conditions:
5 12345 101010
44 23456 202020
333 34567 101010
2222 45678 202020
1 1111 101010
***** 11111
**** 2222
333
*** 44
** 5
*
Lab work -4 (array)
1. WAP to input and print student id, name and grade. Use structure concept.
2. WAP to input id, name and grade for 10 students. Then print them.Use array of structure
concept.
3. WAP to input 20 employees name, position and salary. Then search a record of an employee and
its position on the basis of name.
4. We have two structures as given below.
Struct employee
{
Char ename[100];
Char eaddress[100];
};
Struct salarydetails
{
Char pos[100];
float salary;
struct employee detail;
}payinfo;
WAP to input employees’ details with salary then print them. Use nested struct concept.
5. WAP to input id,name and address of 20 students using struct. Then print them in sorted format
on the basis of name.
6. WAP to input teacher’s id,name, address and subject(any ten records). Then print them on the
basis of id. Use structure concept.
7. WAP to input any 10 student’s name, grade, gender and marks in 5 subjects. Then print all
students’ records with their name, grade, gender, total and percentage. Also print names of
those students whose gender is ‘female’.
8. WAP to input any 10 teacher’s id, name and subject using ‘typedef’ and structure. Then print
them on screen.
9. WAP using function and structure to calculate sum of two distances measured in terms of
kilometers and meters.
For example,
If we input following data
Kilometer meter
23 445
45 756
69 201
The output would be 69 km and 201 meters.
10. WAP to input student id, name and grade and print them. Use union concept.
Lab works-8(pointers)
1. WAP to perform arithmetic calculations (sum, difference, multiplication and division) of two
numbers using pointers.
2. WAP to know a number is even or odd using pointer.
3. WAP to find sum and average of ‘n’ natural numbers using pointer.
4. WAP to print 7, 22, 11, 34, 17… 10th term using function. Pass pointer to function.
5. WAP to find factorial of a number using pointer.
6. Use array to input 10 elements and print them. Use array as pointer.
7. WAP to input 10 elements and print maximum and minimum value.Use array as pointer.
8. WAP to swap two values using call by referenceand call by value.
9. WAP to sort 10 numbers stored in an array using pointer.
10. WAP to print factors of a number using pointer
11. WAP to print multiplication table of a number using pointer.
Lab works-9(Data file)
1. WAP to input a sentence and store data in a data file “file.txt”. And print them on screen. Use getc()
and putc() functions.
2. WAP to store some ‘n’ natural numbers in a data file and print them on screen. Use getw()
function.Also print their average.
3. WAP to store student’s name and address in a data file “student.txt”. Use fprintf() function.
Then read contents of datafile and print them on screen. Use fscanf()function.
4. WAP to store book’s name, edition and price in a data file “book.txt” using yes/no options. It means
the computer stores data until you say ‘n’. Then print them on screen.
5. WAP to store employee’s name, designation and salary in a data file “employee.txt” using fwrite().
The computer stores data until you say ‘n’. Then read the contents of that file and print on screen using
fread().
6. WAP to input students’ name, grade and marks in five subjects. Then store these all data with total
and percentage in a data file “student.dat”.Print all those data of students who have percentage >=80.
You may use fscanf() or fwrite().
e. Exit