PF-lab 4 and 5
PF-lab 4 and 5
1. Write a C program to input a character from user and check whether given character is small
is more than 1999 it will give a discount up to 50%. If the cost of shopping is 2000 to 4000, a 20%
discount will be applied. If the cost of shopping is 4001 to 6000, a 30% discount will be applied.
If it's more than 6000 then 50% discount will be applied to the cost of shopping. Print the actual
−𝑏±√𝑏2 −4𝑎𝑐
. 2𝑎
Teacher asks the student to check whether the input number is divisible by 7 or not. For checking
the divisibility, take the last digit and double it, take the rest of the digits and subtract the
49 -> 4 - 18 = 14 -> 1 - 8 = -7
Write a program that asks for the number of calories and fat grams in a food. The program
should display the percentage of calories that come from fat. If the calories from fat are less
than 30% of the total calories of the food, it should also display a message indicating that the
food is low in fat. One gram of fat has 9 calories, so Calories from fat = fat grams * 9. The
percentage of calories from fat can be calculated as: calories from fat/total calories
Input validation: Make sure the number of calories and fat grams are not less than 0. Also, the
number of calories from fat cannot be greater than the total number of calories. If that happens,
display an error message indicating that either the calories or fat grams were incorrectly entered.
You must have seen the question before deleting anything like “Are you sure to delete
[Y/y] / [N/n] ? Create a program that asks for this question if user enters Y or y it prints
for Black and W for White. Ask the user if the cup size is double and if the coffee is manual.
The following table details the time chart for the machine for each coffee type. Display a
statement for each step. If the coffee size is double, increase the baking time by 50 percent.
Use functions to display instructions to the user and to compute the coffee time.
Write a program in which user enters his NTS and F.Sc marks and your program will help
student in selection of university. Based on these marks Student will be allocated a seat at
Oxford
MIT
The costumer can order any combination of available food. The program first ask to enter
the no of types of snacks i.e. 2, 3 or 4 then it ask to enter the choice i.e. B for Burger and
then for quantity. The program should finally display the total charges for the order.