0% found this document useful (0 votes)
6 views

C Assignmet.docx

Uploaded by

Archa Soman
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

C Assignmet.docx

Uploaded by

Archa Soman
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 56

3.

Write a program to input basic salary and output gross salary

4.Input distance in km and convert to meters, feet, inches and centimeters.


5.Write a program to find the total marks and percentage.

6.Write a program to convert temperature from Fahrenheit to celscius.


7.Write a program to find the perimeter and area of a rectangle and a circle

8.Write a program to interchange the contents of a and b


9.

11.Write a program to obtain the sum of first and last digit in a 4-digit number.
12.

13.
15.

16.
18.
19.Write a program to show the bits of an integer.

20.
The information about colors is to be stored in bits of a char variable called color. The
bit number 0 to 6, each represent 7 colors of a rainbow, i.e. bit 0 represents violet, 1
represents indigo, and so on as given below. Write a program that asks the user to
enter a number and based on this number it reports which colors in the rainbow does
the number represents.
Red Orange Yellow Green Blue Indigo Violet
21.
In an inter-college competition, various sports and games are played between different
colleges like cricket, basketball, football, hockey, lawn tennis, table tennis, carom and
chess. The information regarding the games won by a particular college is stored in bit
numbers 0, 1, 2, 3, 4, 5, 6, 7 respectively of an integer variable called game. The college
that wins in 5 or more than 5 games is awarded the Champion of Champions trophy. If a
number is entered through the keyboard, then write a program to find out whether the
college won the Champion of the Champions trophy or not.

22. The time field in the directory entry is 2 bytes long. Distribution of different bits
which account for hours, minutes and seconds is given below. Write a program which
would receive the two-byte time entry in form of number and print the hours, minutes
and seconds.
HHHHHMMMMMMSSSSS
25.Write a program to determine whether the year is leap or not.
26.Write a program to determine the first day of the year

27.Write a program to find the greatest integer


28.Write a program to obtain the reverse number

30.Write a program to see if the triangle is valid or not.


32.Write a program to determine whether the area of a rectangle is greater that its
perimeter.

33.Write a program to see if the points are on the same line.


34.Write a program to determine whether a point lies on, inside or outside a circle.

35.Write a program to check if the given point is on x axis, y axis or origin.


36.Write a program to determine whether the year is a leap year or not.

37.Write a program to determine whether the given character is in caps or not, digit or
a symbol.
38. 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.
39.
44.

50.Write a program to find out the number of digits in a number


51.

52.Write a program to find the factorial


53.

54.
56.

57.
58.
59.

60.
61.

62.
63.

64.
66.

67.

68.
69.
70.
71.
72.

//In these questions,handle the upper half and lower half seperately.
83.

84.
85.
86.
87.
88.

89.
90.

91.
92.
93.
94.

95.
96.

97.
98.
99.
100.
101.

102.
103.
104.
105.
106.
107.

108.
109.
110.

111.
112.
113.

You might also like