Sie sind auf Seite 1von 2

Section 2

 
PDS Lab Assignment - 3 19.02.2018
 
Instructions:
Create a sub directory named as Lab3.
 
Give the name of the programs as <p>_1.c, <p>_2.c, .. etc. for the problem 1,
2….., respectively. Here <p> implies the part number. For example, Part-A
 
Store all the programs under this assignment in the directory Lab3.
Zip the entire directory Lab3 and rename it as <R>_Lab3_tar.gz. where <R> denotes your Roll No.
You should upload your zipped file to the Moodle course web page latest by 11:55 hrs.
 
 
Part-A
1. Read any three numbers from the keyboard. Print the largest number
you have entered.
2. Read the symbol of a binary arithmetic operator (such as +, -, *, /) and
its two operands from the keyboard and perform the operation on those
two operands depending upon the operator entered by the user.
Print the result accordingly.
3. Read any three points from the keyboard. Check if they can be the
vertices of a triangle. Decide the triangle as scalene, isosceles or right-
angled, if it is valid.

Part-B
4. Write a program to compute and print the taxi fare based on the
following chart. Total number of Kilometers traveled will be input by
the user as a floating point number.
First 12 KM: Rs. 100/-
Next 4 KM: Rs. 8 / KM
Next 4 KM: Rs 6 / KM
Above 20 KM: Rs 5 / KM
 

5. Read a sequence of characters (terminated by new line character ‘\n’)


and count the number of vowels entered.
Part-C
 
6. There is a course with two components: Theory and Lab. There are 70%
and 30% weightage in the theory and lab evaluation respectively. A
grade has to be prepared based on the total marks say X, which is the
total marks obtained in theory and lab tests with the following beak up.

EX: X ≥ 90
A: 80 ≤ X < 90
B: 70 ≤ X < 80
C: 60 ≤ X < 70
D: 50 ≤ X < 60
P: 40 ≤ X < 50
F: X < 40

Further, it is decide to award grace marks to some students based on their


attendance say Y in the theory and lab classes, which is as follows.

If Y ≥ 85% and marks in theory is ≤ 70%, then add 15% of the obtained
theory marks to theory evaluation.
If 75% ≥Y > 85% and marks in theory is ≤ 60%, then add 10% of the
obtained theory marks to theory evaluation.
If 60% ≥Y > 75% and marks in theory is ≤ 50%, then add 5% of the
obtained theory marks to theory evaluation.

There are together 60 classes were held for theory and lab classes. There
are two tests on theory and lab were conducted each of 100 marks. Read
the marks of a students in theory and lab evaluation, and attendance
count of the student. Decide the grade that the student should deserve.
Write a program in C for the above. You should use only switch-
case statements to implement condition and branching logic in your
program.

---*---
Submission instruction
Zip your Lab3 directory. Upload your zip file into the Moodle server.

Das könnte Ihnen auch gefallen