You are on page 1of 5

0uFSTl0t 4_ A certain grade of steel is

graded according to the following


conditions::
1. Hardness must be greater than 50.
2. Carbon content must be less than
0.7.
3. Tensile strength must be greater
than 5600.

The grades are follows::
a_ Grade is 10 if all three conditions
are met.
b_ Grade is 9 if condition 1 and 2 are
met.
c_ Grade is 8 if condition 2 and 3 are
met.
d_ Grade is 7 if condition 1 and 3 are
met.
e_ Grade is 6 if only one condition 1
is met.
f_ Grade is 5 if none of the conditions
are met.

S0luTl0t

#incIude<stdio.h>
#incIude<conio.h>
void main()
{
fIoat hardness,carbon,tensiIe;
int grade;
cIrscr();
printf(" Enter hardness,carbon content &
tensiIe strength :: \n ");
scanf(" %f%f%f
",&hardness,&carbon,&tensiIe);

if(hardness>0&&carbon>=0&&tensiIe>0)
{

if(!(hardness>50&&carbon<0.7&&tensiIe>5600)
)
grade=5;

if(hardness>50||carbon<0.7||tensiIe>5600)
grade=6;
if(hardness>50&&tensiIe>5600)
grade=7;
if(carbon<0.7&&tensiIe>5600)
grade=8;
if(hardness>50&&carbon<0.7)
grade=9;

if(hardness>50&&carbon<0.7&&tensiIe>5600)
grade=10;
printf("\n Grade=%d ",grade);
}
eIse
{
printf("\n Your entry is not vaIid ");
}
getch();

OU97U9
aeou Aaudaoii , oauoa ooaeoae &
eoaiIIo ieuoageA ..
5I

5

5700

uado 7

You might also like