A certain grade of steel is graded according to following condition: (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 as follows: grade is 10 if all three condition are met, Gradeis 9 if conditions (i)and (ii) are met , Grade is 8 if condition (ii) and (iii) are met , Grade is 7 if condition (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 stength of the steel under consideration and output the grade of steel

 A certain grade of steel is graded according to following condition: 

 (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 as follows: 

grade is 10 if all three condition are met,  

 Grade is 9 if conditions (i)and (ii) are met , 

Grade is 8 if condition (ii) and (iii) are met ,

  Grade is 7 if condition (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 steel

#include<stdio.h>

#include<conio.h> 

int main()

{

//h=hardness  of steel

// c= carbon content

//ts=Tensile strength 

float h,cc, ts;

//flag for three condition

int h_f =0,cc_f=0,ts_f=0;

//is 0 represent fales  and one represent for true

int grade;

printf("Enter the value of hardness:");

scanf("%f",&h);

printf("Enter the value of carbon content:");

scanf("%f",&cc);

printf("Enter the value  of tensile strength:");

scanf("%f",&ts);

//for finding grade 

//1 if none of the condition  is met

if(h_f==1||cc_f==1||st_f==1)

grade=5;

//2 if only one condition are met

if(h_f==1||cc_f==1||ts==1)

grade =6;

//3 if condition (i) and (iii) are met

if(h_f==1||cc_f==1&&ts_f==1)

grade 7 ;

//4 if condition (ii) and (iii) are met

if(h_f==1||cc_f==1&&ts_f==1)

grade 8; 

//5 if condition (i) and (iii) are met

if(h_f==1||cc_f==1&&ts_f==0)

grade 9; 

//4 if condition (ii) and (iii) are met

if(h_f==1&&cc_f==1&& ts_f==1)

grade 10;

printf("The grade of steel is :%d ",grade);

}

output-- Enter the value of hardness:60

 Enter the value of carbon content:0.6

 Enter the value  of tensile strength:5800

The grade of steel is:10



 

related question-

 Wind chill factor is the felt air temperature on exposed skin due to wind chill temperature is always lower than the air temperature ,and is calculated as per the following formula: wcf=35.74+0.6215t+(0.4275-35.75)*v^0.16. where t is the temperature and v is the wind velocity .write a program to receive values of t and v and calculate wind chill factor (wcf).

Two number are input through the keyboard into two locations C and D write a program to interchange the contents of C and D. 

If the three of triangle are entered through the keyboard write a program to check whether the triangle is isosceles equilateral ,scalene or right angle triangle. 

 A digital world colors are specified in Red ,Green ,Blue(RGB) format with value of (R,G,B) varying on integers scale from 0 to 255 in point publishing the colors are mentioned in cyan, magenta - yellow black (CMYK) format ,with value of C,M,Y and k varying on real scale from 0.0 to 1.0 write the program to convert RGB colors to CMYK as per the following formula.. White=max(Red/255,Green/255,Blue/255), cyan=(white-Red/255)/white Magenta=(white -Green/255)/white black = 1-white. note that if RGB value are all 0 then the cmy values are all 0 and the k value is 1.

 

Comments

Popular posts from this blog

class with array in c++ (memory allocatin & using array in classes)

constructor with default arguments

constructor overloading in c++ programming