Practice Assignment

Only available on StudyMode
  • Download(s) : 111
  • Published : March 12, 2013
Open Document
Text Preview
Assignment – Formula Translation
Total Marks: 100

Problem 1:
In a town, the percentage of men is 52.The percentage of total literacy is 48.If total percentage of literate men is 35 of the total population, write a program to find the total number of illiterate men and women if the population of town is 80,000.

Problem 2:
When Cheryl Harrison began her trip from Newyork to Wyoming; she filled her car’s tank with gas and reset its trip meter to zero. After traveling 324 miles, Cheryl stopped at a gas station to refuel; the gas tank required 17 gallons. Cheryl wants a program that calculates and displays her car’s gas mileage at any time during the trip. The gas mileage is the number of miles her car was driven per gallon of gas. Write a C code that can implement

Problem 3:
The manager of the Lakeview Hotel wants a program that calculates and displays a guest's total bill. Each guest pays a room charge that is based on a per-night rate. For example if the per night rate is $100 and the guest stays two nights, the room charge is $200.Customer also may incur a one-time room service charge and a one-time telephone charge.

Problem 4:
Write a c code that will calculate the roots of a quadratic equation a2+ bx+c=0 Hint: d = sqrt (b2-4ac), and the roots are: x1 = (–b + d)/2a and x2 = (–b – d)/2a (use sqrt function from cmath.h ) Problem 5: Hero’s Formula is A method for calculating the area of a triangle when you know the lengths of all three sides. Let a, b, c be the lengths of the sides of a triangle. The area is given by:A= pp-ap-b(p-c)| wherep= a+b+c2|

Write a C-language code to calculate area of triangle using above method. Take the three lengths of the triangle from the user and display the area that your program calculates.

Problem 6:
Area of a trapezoid can be calculated by the following formula: A=(b1+b2)×h2
where b1 and b2 are the parallel sides or the bases and h is length of height Write a...
tracking img