0
Write a code for this task in C
You are making an app that should remind you when its the time to change the oil in your car. The oil needs to change if the mileage after the last change is over 10.000, or if the last oil change has been over 12 months ago. Task: Take the mileage and months values from input and output "Change Oil", in case the conditions above are satisfied. In case its not the time for an oil change, output "OK".
6 ответов
+ 5
Seepana chandu ,
> can you describe the issue you have?
> can you also provide the input values that are used and create the issue above?
>> can you check if `10.000` is the correct value for the comparison?
+ 3
I think it should be like 10 thousand
If one of the two values gets over the limit there should be a change, both of them should be good.
+ 2
You should share your code attempt, so we can help you.
+ 1
#include <stdio.h>
int main() {
int mileage;
scanf("%d", &mileage);
int months;
scanf("%d", &months);
if (mileage <= 10.000 || months <= 12) {
printf("OK");
} else {
printf("Change Oil");
}
return 0;
}
0
Actually it is 10000
0
Make it > 10000