-
Notifications
You must be signed in to change notification settings - Fork 0
/
steelProp.c
39 lines (33 loc) · 843 Bytes
/
steelProp.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*This is a program to determine the hardness, carbon content and tensile strength of steel and output the grade of steel.*/
/*AUTHOR: Rapteon; DATE:2019-01-04*/
#include<stdio.h>
int main(){
int grade, hardness,tStrength;
float carbon;
printf("Enter the hardness of the steel...");
scanf("%d",&hardness);
printf("Enter the carbon content of the steel...");
scanf("%f",&carbon);
printf("Enter the tensile strength of the steel...");
scanf("%d",&tStrength);
if((hardness>50)||(carbon<0.7)||(tStrength>5600)){
grade=6;
}
if((hardness>50)&&(carbon<0.7)&&(tStrength>5600)){
grade=10;
}
else if((hardness>50)&&(carbon<0.7))
{
grade = 9;
}
else if((carbon<0.7)&&(tStrength>5600)){
grade=8;
}
else if((hardness>50)&&(tStrength>5600)){
grade=7;
}
else{
grade=5;
}
printf("The steel is of grade %d.\n",grade);
}