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".

12th Dec 2023, 11:55 PM
Seepana chandu
Seepana chandu - avatar
6 Respostas
+ 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?
13th Dec 2023, 12:06 PM
Lothar
Lothar - avatar
+ 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.
13th Dec 2023, 4:12 PM
Mafdi
Mafdi - avatar
+ 2
You should share your code attempt, so we can help you.
13th Dec 2023, 7:33 AM
Mafdi
Mafdi - avatar
+ 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; }
13th Dec 2023, 10:12 AM
Seepana chandu
Seepana chandu - avatar
0
Actually it is 10000
20th Jan 2024, 6:08 AM
Hemraj Raikwar
Hemraj Raikwar - avatar
0
Make it > 10000
20th Jan 2024, 6:09 AM
Hemraj Raikwar
Hemraj Raikwar - avatar