The diameter of a cycle wheel is D. Given that, the cycle travels at an average speed of X km/h,
find the number of revolutions made by the wheel per minute, giving your answer to the nearest whole
number (assume PI = 3.142). Write a C++ function to calculate revolutions per minute.
#define PI 3.142
#include <math.h>
int calcrev(double D, double X) {
double C = PI * D;
X = X * 1000.0 / 60.0;
return (int)round(X / C);
}
Comments
Leave a comment