int substance[5]={0.15, 0.8, 35.3, 401, 46};
printf("Please select the substance: (1)Oak (2)Glass (3)Lead (4)Copper (5)Steel)");
scanf("lf%", substance[0])
In the array, I have the data for different material,
I want the user to type 1-5 and select one of the material. say, user select 2, the the following calculation will use number 0.8
scanfcall supposed to do?int[]is the wrong type: should bedouble[]. Andscanf("lf%", substance[0])should bescanf("lf%", &substance[0])if that is the case.int substance[5]={0.15, 0.8, 35.3, 401, 46};WFT?? Is your intent to force integer rounding within the initialization? There isn't a technical problem, but it looks bad....