When you have conditions that are used to find a value, in your case grade, then it is best to use a variable and store the value as the program runs. Here some of the conditions make the program print again, more outputs than one because you don't stop the outputs in a controlled way.
Besides the program is difficult to read because the printf() everywhere is covering the programs purpose, which is to calculate a number, then print it.
I give you the solution for studying. You are quite a few hours working now, and probably tired. Sometimes things are understood better when we leave them for a while to relax, and focus on what we were learning.
matsp is right about the pen and paper thing. Make a plan, before writing code. Use only the things you have learned well and understand. This program introduces nested if's.
Imagine trying all the combinations of the three conditions you stated. There are 3 combinations which are NOT mutually exclusive. Try to figure out which they are.
And since they are NOT mutually exclusive, they cannot be tested on the same level of nesting.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
main()
{
clrscr();
int h,t;
float c;
int grade;
printf("Enter The Hardness , Tensile Strength And Carbon Content");
scanf("%d%d%f",&h,&t,&c);
if(h>50)
{
if(c<0.7)
{
if(t>5600)
grade = 10; /* All three hold here */
else
grade = 9;
} else
{
if(t>5600)
grade = 7;
else
grade = 6; /* h>50 was only satisfied */
}
} else
{
if(c<0.7)
{
if(t>5600)
grade = 8;
else
grade = 6; /* c<0.7 was only satisfied */
} else
if(t>5600)
grade = 6; /* t>5600 was only satisfied */
else
grade = 5; /* None was satisfied */
}
printf(" The Grade is %d",grade);
getch();
}
Note that for three conditions there are eight combinations. For four there would be sixteen. Sometimes, it is possible to significantly reduce the number of conditions to be tested to reach a correct answer. But that demands understanding how to perform reduction on boolean algebra. At such cases it is best to break a problem to smaller bits, rather than trying to solve it all at once.