CHECK OUT HERE AND FIND AMAZING STUFF HERE
Topics Covered:-
Ø Decision Control and
Conditional Operators
1. 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
|
65-90
|
a-z
|
97-122
|
0-9
|
48-57
|
Special symbols
|
0-47,58-64,91-96,123-127
|
2. 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 the 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.
3. A
library charges a fine for every book returned late. For first 5 days the fine
is 50 paise, for 6-10 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 book and
display the fine or the appropriate message.
Ø Case Control
Structure (Switch statement)
1. WAP using switch case
statement in C
Prompt the user to enter the grade of a student.
Print message as mentioned below:-
Grade A:-Excellent
Grade B:-Good
Grade C:-Ok
Grade D:-Poor
2. Write
a menu driven program which has the following options:-
1. Factorial
of a number
2. Prime
or not
3. Odd
or even
4. Exit
Once
a menu item is selected the appropriate action should be taken.
3. WAP
to find the grace marks for a student using switch. The user should enter the
class obtained by the student followed by the number of subjects he has failed
in. Use the following logic:-
Ø If
the student gets first class and the number of subjects he failed in is greater than 3, then he does not get any grace. If the number of subjects he failed in
is less than or equal to 3, then the grace is of 5 marks per subject.
Ø If
the student gets a second class and the number of subjects he failed in is
greater than 2, then he does not get any grace. If the number of subjects he
failed in is less than or equal to 2, then the grace is of 4 marks per subject.
Ø If
the student gets third class and the number of subjects he failed in is greater
than 1, then he does not get any grace. If the number of subjects he failed in
is equal to 1, then the grace is of 5 marks per subject.
No comments:
Post a Comment