0% found this document useful (0 votes)
12 views10 pages

PF-lab 4 and 5

Uploaded by

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

PF-lab 4 and 5

Uploaded by

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

NED University of Engineering &

1. Write a C program to input a character from user and check whether given character is small

alphabet, capital alphabet, digit or special character, using if else.


An online shopping store is providing discounts on the items due to the Eid. If the cost of items

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

amount, saved amount and the amount after discount.


Write a C program to find all roots of a quadratic equation by using the given formula; it is

required to take user input for a, b and c values

−𝑏±√𝑏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

doubled last digit repeat until the result is 7, -7 or 0. For example:

10976 -> 1097-12 = 1085 -> 108-10 = 98 -> 9-16 = -7

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

“Deleted successfully”. If the user enters N or n it prints “Delete cancelled” otherwise it

prints choose the right option using switch statement.


Write a program to control a coffee machine. Allow the user to input the type of coffee as B

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

different department of different university.

Oxford

IT: Above 70% in Fsc. and 70 % in NTS

Electronics: Above 70% in Fsc. and 60 % in NTS

Telecommunication Above 70% in Fsc. and 50 % in NTS

MIT

IT: 70% - 60 % in Fsc. and 50 % in NTS

Chemical: 59% – 50 % in Fsc. and 50 % in NTS

Computer: Above 40% and below 50 % in Fsc. and 50 % in NTS


Using IF and Switch statement, write a program that displays the following menu for the

food items available to take order from the customer:

B= Burger (Rs. 200)

F= French Fries (Rs. 50)

P= Pizza (Rs. 500)

S= Sandwiches (Rs. 150)

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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy