Im trying to find the average of three numbers however it only rounds it to the nearest whole number. What code can i use to get the exact number?
For example at the minute it would add 2 + 3 + 2. The outcome would be 2 but i would like it to be the exact value i.e. 2.33

you are doing integer math and you need to do floating point math

int a = 2;
int b = 3;
int c = 2;
float result = (float)(a+b+c)/3.0F
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.