**Chapter Lists for "Let us C Solution"**

S.N |
Chapter |
S.N |
Chapter |

1. |
5 |
||

2. |
6. |
||

3. |
7. |
||

4. |
8. |

**CHAPTER:**

**The Decision Control Structure solutions:**

-------------------------------------------------------------------

if,if-else,Nested if-else

**[C] Attempt the following:**

(a)
If cost price and selling price of an item is input through the keyboard, write a program to determine whether the seller has made profit or incurred loss. Also determine how much profit he made or loss he incurred.

download solution (.c)
download solution (.exe)

(b) Any integer is input through the keyboard. Write a program to find out whether it is an odd number or even number.

download solution (.c)
download solution (.exe)

View Solution Here...

(c) Any year is input through the keyboard. Write a program to determine whether the year is a leap year or not.
(Hint: Use the % (modulus) operator)

download solution (.c)
download solution (.exe)

View Solution Here...

(d) According to the Gregorian calendar, it was Monday on the date 01/01/1900. If any year is input through the keyboard write a program to find out what is the day on 1st January of this year.

download solution (.c)
download solution (.exe)

View Solution Here...

(e) A five-digit number is entered through the keyboard. Write a program to obtain the reversed number and to determine whether the original and reversed numbers are equal or not.

download solution (.c)
download solution (.exe)

View Solution Here...

(f) If the ages of Ram, Shyam and Ajay are input through the keyboard, write a program to determine the youngest of the three.

download solution (.c)
download solution (.exe)

View Solution Here...

(g) Write a program to check whether a triangle is valid or not, when the three angles of the triangle are entered through the keyboard. A triangle is valid if the sum of all the three angles is equal to 180 degrees.

download solution (.c)
download solution (.exe)

View Solution Here...

(h) Find the absolute value of a number entered through the keyboard.

download solution (.c)
download solution (.exe)

View Solution Here...

(i) Given the length and breadth of a rectangle, write a program to find whether the area of the rectangle is greater than its perimeter. For example, the area of the rectangle with length = 5 and breadth = 4 is greater than its perimeter.

download solution (.c)
download solution (.exe)

View Solution Here...

(j) Given three points (x1, y1), (x2, y2) and (x3, y3), write a program to check if all the three points fall on one straight line.

download solution (.c)
download solution (.exe)

View Solution Here...

(k) Given the coordinates (x, y) of a center of a circle and it’s radius, write a program which will determine whether a point lies inside the circle, on the circle or outside the circle.
(Hint: Use sqrt( ) and pow( ) functions)

download solution (.c)
download solution (.exe)

View Solution Here...

(l) Given a point (x, y), write a program to find out if it lies on the x-axis, y-axis or at the origin, viz. (0, 0)

View Solution Here...

-------------------------------------------------------------------

[F] ([G] in 4th edition ) Attempt the following:

(a) Any year is entered through the keyboard, write a program to determine whether the year is leap or not. Use the logical operators && and ||.

download solution (.c)
download solution (.exe)

View Solution Here...

(b) Any character is entered through the keyboard, write a program to determine whether the character entered is a capital letter, a small case letter, a digit or a special symbol. The following table shows the range of ASCII values for various characters.

Characters | ASCII Values |
---|---|

A – Z a – z 0 – 9 special symbols |
65 – 90 97 – 122 48 – 57 0 - 47, 58 - 64, 91 - 96, 123 - 127 |

download solution (.c) download solution (.exe)

View Solution Here...

(c) An Insurance company follows following rules to calculate premium.

(1) If a person’s health is excellent and the person is between 25 and 35 years of age and lives in a city and is a male then the premium is Rs. 4 per thousand and his policy amount cannot exceed Rs. 2 lakhs.

(2) If a person satisfies all the above conditions except that the sex is female then the premium is Rs. 3 per thousand and her policy amount cannot exceed Rs. 1 lakh.

(3) If a person’s health is poor and the person is between 25 and 35 years of age and lives in a village and is a male
then the premium is Rs. 6 per thousand and his policy cannot exceed Rs. 10,000.

(4) In all other cases the person is not insured.

Write a program to output whether the person should be insured or not, his/her premium rate and maximum amount for which he/she can be insured.

download solution (.c)
download solution (.exe)

View Solution Here...

(d) A certain grade of steel is graded according to the following conditions:

(i) Hardness must be greater than 50

(ii) Carbon content must be less than 0.7

(iii) Tensile strength must be greater than 5600

The grades are as follows:

Grade is 10 if all three conditions are met

Grade is 9 if conditions (i) and (ii) are met

Grade is 8 if conditions (ii) and (iii) are met

Grade is 7 if conditions (i) and (iii) are met

Grade is 6 if only one condition is met

Grade is 5 if none of the conditions are met

Write a program, which will require the user to give values of hardness, carbon content and tensile strength of the steel under consideration and output the grade of the steel.

download solution (.c)
download solution (.exe)

View Solution Here...

(e)A library charges a fine for every book returned late. For first 5 days the fine is 50 paise, for 6-10 days fine is one rupee and above 10 days fine is 5 rupees. If you return the book after 30 days your membership will be cancelled. Write a program to accept the number of days the member is late to return the book and display the fine or the appropriate message.

download solution (.c)
download solution (.exe)

View Solution Here...

(f)If the three sides of a triangle are entered through the keyboard, write a program to check whether the triangle is valid or not. The triangle is valid if the sum of two sides is greater than the largest of the three sides.

download solution (.c)
download solution (.exe)

View Solution Here...

(g)If the three sides of a triangle are entered through the keyboard, write a program to check whether the triangle is isosceles, equilateral, scalene or right angled triangle.

download solution (.c)
download solution (.exe)

View Solution Here...

(h) In a company, worker efficiency is determined on the basis of the time required for a worker to complete a particular job. If the time taken by the worker is between 2 – 3 hours, then the worker is said to be highly efficient. If the time required by the worker is between 3 – 4 hours, then the worker is ordered to improve speed. If the time taken is between 4 – 5 hours, the worker is given training to improve his speed, and if the time taken by the worker is more than 5 hours, then the worker has to leave the company. If the time taken by the worker is input through the keyboard, find the efficiency of the worker.

download solution (.c)
download solution (.exe)

View Solution Here...

(i) A university has the following rules for a student to qualify for a degree with A as the main subject and B as the subsidiary subject:

(a) He should get 55 percent or more in A and 45 percent or more in B.

(b) If he gets less than 55 percent in A he should get 55 percent or more in B. However, he should get at least 45 percent in A.

(c) If he gets less than 45 percent in B and 65 percent or more in A he is allowed to reappear in an examination in B to qualify.

(d) In all other cases he is declared to have failed.

Write a program to receive marks in A and B and Output whether the student has passed, failed or is allowed to reappear in B.

download solution (.c)
download solution (.exe)

View Solution Here...

(j) The policy followed by a company to process customer orders is given by the following rules:

(a) If a customer order is less than or equal to that in stock and has credit is OK, supply has requirement.

(b) If has credit is not OK do not supply. Send him intimation.

(c) If has credit is Ok but the item in stock is less than has order, supply what is in stock. Intimate to him data the balance will be shipped.

Write a C program to implement the company policy

download solution (.c)
download solution (.exe)

View Solution Here...

----------------------------[J]( [k]in 4th edition) Attempt the following:

(a)Using conditional operators determine:

(1) Whether the character entered through the keyboard is a lower case alphabet or not.

(2) Whether a character entered through the keyboard is a special symbol or not.

download solution (.c)
download solution (.exe)

View Solution Here...

(b) Write a program using conditional operators to determine whether a year entered through the keyboard is a leap year or not.

download solution (.c)
download solution (.exe)

View Solution Here...

(c) Write a program to find the greatest of the three numbers entered through the keyboard using conditional operators.

download solution (.c)
download solution (.exe)

View Solution Here...