Showing posts with label let us c solutions. Show all posts
Showing posts with label let us c solutions. Show all posts

Sunday, 24 July 2011

[chapter 2 part 1]let us c [SOLVED]


[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.


click here for Answer!!!



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

click here for Answer!!!


(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)

click here for Answer!!!


(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.

click here for Answer!!!


(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.


click here for Answer!!!


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

click here for Answer!!!


(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.

click here for Answer!!!


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


click here for Answer!!!


(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.

click here for Answer!!!


(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.

click here for Answer!!!


(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)


click here for Answer!!!


(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).


click here for Answer!!!

Saturday, 23 July 2011

[chapter 1]let us c [SOLVED]


[H]write C programs for the following:

(a)Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.

click here for Answer!!!


(b)The distance between two cities (in km.) is input through the keyboard. Write a program to convert and print this distance in meters, feet, inches and centimeters.

click here for Answer!!!


(c) If the marks obtained by a student in five different subjects are input through the keyboard, find out the aggregate marks and percentage marks obtained by the student. Assume that the maximum marks that can be obtained by a student in each subject is 100.

click here for Answer!!!


(d)Temperature of a city in Fahrenheit degrees is input through the keyboard. Write a program to convert this temperature into Centigrade degrees.

click here for Answer!!!


(e) The length & breadth of a rectangle and radius of a circle are input through the keyboard. Write a program to calculate the area & perimeter of the rectangle, and the area & circumference of the circle.

click here for Answer!!!


(f) Two numbers are input through the keyboard into two locations C and D. Write a program to interchange the contents of C and D.
click here for Answer!!!


(g) If a five-digit number is input through the keyboard, write a program to calculate the sum of its digits.
(Hint: Use the modulus operator ‘%’)


click here for Answer!!!


(h) If a five-digit number is input through the keyboard, write a program to reverse the number.

click here for Answer!!!


(i) If a four-digit number is input through the keyboard, write a program to obtain the sum of the first and last digit of this number.

click here for Answer!!!


(k) A cashier has currency notes of denominations 10, 50 and 100. If the amount to be withdrawn is input through the keyboard in hundreds, find the total number of currency notes of each denomination the cashier will have to give to the withdrawer.

click here for Answer!!!


(l) If the total selling price of 15 items and the total profit earned on them is input through the keyboard, write a program to find the cost price of one item.

click here for Answer!!!


(m) If a five-digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits. For example if the number that is input is 12391 then the output should be displayed as 23402.

click here for Answer!!!