so I want to take the totalPoints divide it by 850 then multiply it by 100 giving me a whole number, my problem is when i use my printf to display the new total it comes out at 0 or a number that i wasnt expecting.

totalPoints=grade1+grade2+grade3+grade4+midterm+attendence;

	
	printf("total points so far: %d out of 850\n\n", totalPoints);


	total=totalPoints/850*100;

	printf("%d\n", total);

Because integer division truncates. 200 * (1/2) = 0 because 1/2 = 0 using integers.
Cast your values to floats during the equation: (float)200 * ((float)1/(float)2) = 100

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.