# c) A certain grade of steel is graded according to the following conditions: (i) Hardness must be greater than 50 (ii) The 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.

G
Sections
3
Exercises

A

B

C

D

E

F

G

H

I

J

K

1

2

3

4

5

6

7

8

9

10

11

13

``````#include<stdio.h>
#include<conio.h>
int main()
{
float h, c, t;
int one = 0, two = 0, three = 0, grade;

printf("\nEnter the hardness, carbon content and tensile strength : ");
scanf("%f%f%f", &h, &c, &t);

//Conditions one, two and three
if(h > 50)
one = 1;
if(c < 0.7)
two = 1;
if(t > 5600)
three = 1;

if(one && two && three)
else if(one && two && !three)
else if(two && three && !one)
else if(one && three && !two)
© 2020 Garbage Value 