0% found this document useful (0 votes)
9 views12 pages

bsd1002_labmanual (1)

Uploaded by

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

bsd1002_labmanual (1)

Uploaded by

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

Week-1

Program 1: Write a program to swap two numbers


a. Using a temporary variable
b. Without using a temporary variable

Program 2: Write a C program to solve given expression. Res=a*(b+c)*d-e, read the values
from the standard input device. The output should be displayed in below fashion
Format 1:Result =Value of expression
Format 2:The output of the expression a= b= c= d= e= is (value of expression)
Example:if a=2.5 ,b=3,c=10 ,d=2 e=4
1st Output:Result=61.000000
2nd Output:The output of the expression a=2.5 b= 3 c= 10 d=2 e=4 is 61.000000

Program 3: Write a program to size of all basic data types.

Program 4: In an organization the gross salary for an employee is computed as per the below
formula
Gross salary = Basic salary + HRA + DA
After computing the gross salary, the net salary is computed using the below formula
Net salary = Gross salary – Professional tax – income tax
Requirements:
a. The Basic salary, HRA and DA has to be captured
b. The gross salary has to be computed using the above formula
c. Professional tax has to be captured ( Rs. 200)
d. Income tax is the 10% of the gross salary
e. Net salary has to be computed using the above formula
f. Display the net salary drawn by the employee

Exercise 1: As there is lock down everywhere, and the time allocated for shopping is
restricted, Mr. Umar goes for shopping in the specified time, He went to vegetable super
market, He purchased some vegetables and fruits the total bill was “m” Rs. and he got a
discount of 10% there. Next he went to Buy n Save shop and purchased the groceries and the
bill amount generated there was “n” Rs and here he got a discount of 12.5%. Later he went to
buy medicine and there the bill was “p” Rs. and there also he got a discount of 18%.
His mother asked the bill details and the total amount he spent today. Help to create a C
application for the same.
Week 2:
Program 1: General Elections were announced by the election commission. Mr. Gautam is a
young person who is very much enthusiastic to cast his vote. He would like to know whether
he is eligible to vote or not.
Following are requirements to solve the problem
a. The birth year of Mr. Gautam has to be captured to check the eligibility.
b. Compute the age of Mr. Gautam.
c. Minimum age required to cast the vote is 18 years.
d. Confirmation should be displayed regarding the eligibility to vote.

Exercise 1: Write a program to check the given year is leap or not

Program 2: A ball is thrown straight up from the ground at a particular distance, with some
velocity. After sometime the ball has to come back to the ground. At what time the ball hits
the ground? To solve this we can make use of quadratic equation where given the height,
velocity and gravity
i.e; gravity*t2+velocity*t +height=0

Program 3: As many of the students like chats like chips, juice, chocolates, a vending
machine is kept at several places. The person after putting the cash has to enter the product
code so as to get it.
The code is as follows
Code Product
106 Haldiram Ratmali Sev
206 Haldiram Instant Bhel
306 Fuse Chocolate
406 Mixed Fruit Juice
506 Lassi

Depending on the code entered the item will be selected and given to the person who feeds
amount. An application has to be developed as to how it automatically works after entering
the code.
Exercise 2: Modify Program 3 into switch statement
Week 3
Program 1: Radha has bought 5 books for reference to prepare for her semester exams. She
has studied in mathematics course that the factorial of n items gives the number of ways that
she can use to arrange the n items. Radha would like to know in how many ways she can
arrange the five books that she has bought

Program 2: It is said that during any ATM transaction if someone comes and attacks then
enter the ATM pin in reverse order so that it alarms and sends a message to nearest police
station. Mr. Varun wants to withdraw some amount and goes to HDFC ATM to do the
transaction and suddenly an unknown person wearing mask will enter inside and demands
money, Mr. Varun will be fully tensed and he will enter the PIN urgently, but if the reversed
pin will be same as original then Mr.Varun will be in trouble as no alarm will be generated.
Check whether the alarm is alerted and a message is sent to the nearest police station or
Mr.Varun will be in trouble.
Exercise 1:
Mr Suraj bought a new car. He want to get it registered in RTO office. Mr Suraj think that
odd number registration number is lucky for him. RTO has given him option to choose the
number from the pool of numbers. Mr Suraj want to check when he add all the digits in the
number if he get odd number or even.
Week 4

Program 1: Mr. Umar is very much interested to know how the calculator will give the result
for trigonometric functions, after some research he gets to know that the mathematical
concepts behind it. He just wants to try with respect to sin(x) and with the help of
mathematics faculty he solves the taylor series to get the answer of sin(x), the series are as
follows
Sin(x)=x-(x3/3!)+(x5/5!)-(x7/7!)+…….
Help Mr. Umar to program the same.

Program 2: As online class is going on multiple software’s are used to conduct the class. If
they use any software the free editions are limited after some classes they need to purchase
the software and continue the session. They can try with different software, once they try they
will come to know whether its good and can continue ahead. Prof. Martin uses a software, the
software has 5 free sessions to engage, initially he will try with the software , if he feels its
comfortable then he will continue with that version for 5 sessions. An application has to be
generated to the software company to know that the users are satisfied and the number of
sessions they have used.

Program 3: Write C Program to display the following patterns:


P1P1P1P1P1
P2P2P2P2P2
P3P3P3P3P3
P4P4P4P4P4
P5P5P5P5P5

P1
P1P2
P1P2P3
P1P2P3P4
P1P2P3P4P5
Week 5
Program 1: Mr. Pratheek wants to buy 10 items from the shop. He want to store the price of
all the items. Help Mr. Pratheek to store the price of all ten items.

Program 2: After shopping Mr.Pratheek wants to know the total amount of bill that he has to
pay to the shop. Help Mr.Pratheek to calculate sum of all price and display the bill amount.

Program 3: In the college there was auditions going on for music club, each student was
given a number. Mr. Mallikarjun who was interested in music also participated in the
auditions. At the end of the day 10 students were selected and there numbers were displayed
on the notice board. Tell Whether Mr. Mallikarjun is selected or not.

Exercise 1:
BSc students plans for a trip. N students will go for trip. Each student spends some
amount on purchasing m items in the place the visit. The next day faculty ask the
student who has purchased an item with minimum cost. A software application has to
be developed for the same:
 Read the number of students and no. of items.
 Read the cost of each item.
 Identify the minimum cost item among all.
 Display the minimum cost item.
Week 6

Program 1: Mr. Ganesh was making noise in the class. So he was given the task to arrange
the boxes in an order. Each box is placed in each room. The teacher told him to arrange in
ascending order. He has to compare the size of the box and arrange them. Help Mr. Ganesh
in the logic of sorting and generate a C application for the same.

Program 2: Mr. Raihaan is a research scholar and is currently working on images. He know
that any image will be saved in the format of rows and column at the lower level that is in the
form of a matrix. He wants a particular pattern with “m” rows and “n” columns to identify in
the given image. Before identifying he wants to read the image pattern he wants to search.
Help Mr. Raihaan in reading the pattern.

Program 3: Mr. Raihaan upon reading a pattern wants to mask two images, the masking
techniques is to multiple the pixels of two images original image and masking imahe , help
Mr. Raihaan to perform the matrix multiplication.

Exercise 1:
Write a program to compute and store the Fibonacci series in an array and display the
elements of array.

Week 7
Program 1: Program to demonstrate Declare, Read and Display the string using formatted I/O
statements
Program 2: Program to demonstrate Declare, Read and Display the string Using unformatted
I/O functions.
Program 3: Write a C program to find length of string.
a. Using library function
b. Without using library function

Program 4: Write a Program to copy one string to another string.


a. Using library function
b. Without using library function
Program 5: Write a program to concatenate two strings.
Program 6: Write a program to compare two strings.

Week 8
Program 1: Write a C program that reads a line of text and counts all occurrence of a particular word.
Program 2: Write a C program to determine if the given string is a palindrome or not.
Program 3: Write a C Program to find factorial of a number using following function categories
1. Without parameter, without return type
2. Without parameter, with return type
3. With parameter, without return type
4. With parameter, with return type

Week 9
n
Program 1: Mr. Pratham is given the task to write the code to find the Cr. He knows the he
has to find out the factorial of the number. Help Mr. Pratham to code to get the required
answer.

Program 2: Write a c program to read the values to the array and pass the array to the
function with the signature void prime(int a[],int n) which checks whether the elements of
the array is prime or not. If the array element is not prime set that value to 0. And in the main
program display the array elements which are prime

Program 3: Write a c program to find the greatest common divisor of two given integers using
recursion.

Exercise: 1Write programs to complete these operations.


Choice Operations Function signature
1 Area of the circle float Circle_area(int radius)
2 Check if the number if even or void iseven(int number)
odd
Week 10
Program 1: Write a program to create a structure of point with x and y as parameter, read the
values and display the values of it.
Program 2: Write a program to create a structure of complex number with x and y and find
the sum of two complex numbers
Program 3: Three students were short listed for the toppers in BCA class. As few students
are noted for their sincerity and there scoring they made a guess of a name. Check whether
the name guesses is present or not. If present display his /her name along with his/her cgpa
Program 4: Write a program to find the size of a structure variable and union variable and
read and display the elements of it considering the member function int x and double y.
Week 11
Program 1: Write a program to explain the concept of array of structures given the structure
student containing the student name, sem and cgpa , read and display the details of n students.

Program 2: Write a program to swap two numbers using function and pointers
Program 3: Write a program to find the sum of array using pointers.
Program 4: Write a program to read and display the content using fscanf() and fprintf()
function

Week 12
Program 1: Write a program to read and display the content using fgets() and fputs() function
Program 2: Write a C program to copy the contents of one file to another.
Program 3: Two files DATA1 and DATA2 contain sorted lists of integers. Write a C program to
merge the contents of two files into a third file DATA i.e., the contents of the first file followed by
those of the second are put in the third file

You might also like