Version A
1) Write a C program that uses nested loops to print the following figure.
bb
ccc
dddd
eeeee
Note that ASCII value of ‘a’ is 97 (10 marks)
2) You are asked to write a C program to calculate the increment given for the employees.
Write a function called calcIncrement() to calculate and return the increment given for the employees. The increment amount is 10% of the salary. Increment is given only to the employees who worked more than 2 years . Function prototype is given below.
float calcIncrement (float salary, int noofYearsWorked);
Write a function called calcTotSalary() to calculate the total salary.
(total salary = salary + increment ).
float calcTotSalary (float salary, float increment);
In your main function enter the salary of an employee and the number of years worked from the keyboard. Display the increment and total salary as follows using the functions created above.
Enter no of years worked: ……..
Increment: ………….
Total Salary :………………… (10 marks)
Version B
1) Write a C program that uses nested loops to print the following figure.
bbbb
ccc
dd
e
Note that ASCII value of ‘a’ is 97 (10 marks)
2) A hotel has decided to offer 10% discounts from hotel charge for the wedding packages
during the festive season. Discount is valid only if the no of guests is more than 200.
(Hotel charge = no of guests * charge per guest)
You are asked to write a C program to calculate the discount given for wedding packages.
Write a function called getDiscountPrice() to get the discount for the wedding package by considering no of guests. Function should return the discount. Function prototype is given below.
float getDiscountPrice (int noOfGuests, float chargePerGuest);
Write a function called getAmount() to calculate and return the amount to be paid. Function prototype is given below.
Amount to be paid = (no of guests * charge per guest )- discount
float getAmount (int noOfGuests, float chargePerGuest, float discount);
In your main function read the number of guests and the charge per guest from the keyboard and display the discount and the amount to be paid for the wedding package using the functions created above in the following format.
Enter charge per guest: ……..
Discount: ……..
Amount to be paid: ………… ( 10 marks)
Version C
1) Write a C program that uses nested loops to print the following;
[ 1 1 2 ]
[ 1 2 1 ]
[ 1 2 2 ]
[ 2 1 1 ]
[ 2 1 2 ]
[ 2 2 1 ]
[ 2 2 2 ] ( 10 marks)
2) A security firm has categorized their employees into 3 grades and an hourly rate is paid based on the grade as follows
Grade | Hourly Rate (Rs) |
1 | 100 |
2 | 200 |
3 | 300 |
Version D
Item | Unit Price (Rs) |
1 | 100 |
2 | 200 |
3 | 300 |
Total cost = unit price * quantity (Function prototype is given below.)
float calculateTotalCost(int itemNo, int quantity)
Implement a function called printDetails() to print the item no, quantity and the total cost Function prototype is given below.
void printDetails(int item no, int quantity, float totalCost)
In your main function, input item no and the quantity purchased from the keyboard. Call printDetails() function and display the details. (10 marks)
Version E
Angle(degrees) | Angle(radians) |
100 | ___ |
120 | ___ |
140 | ___ |
160 | ___ |
180 | ___ |
200 | ___ |
1 Comments
Aiye meke answers nadda?
ReplyDelete