Is my code correct??? I would like to find the percentage like for example:
30pcs of 60pcs is 50%. But how do I code it??? I mean, how to code to get the PERCENTAGE... Is the formula:
(num/total) * 100 ??? Is this correct:
for(x=0;x<3;x++)
{
y=total[x];
p[x]=((float)(y/grand))*100;
}
I put 'y' variable to have the 'total[x]' value becuase the compiler will say that it is an error. I think it's like declaration syntax error... I forgot... Please help me.... And by the way, this is a TURBO C program...
One of the most important things to include with questions like these is the data types. A small snippet (say less than 100 lines) ofcompileable code that demonstrates the problems is always best.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
>OK thanks for the info... But is code correct?One of the most important things to include with questions like these is the data types. A small snippet (say less than 100 lines) of compileable code that demonstrates the problems is always best.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314