write a program, When the racer is outside the covered section:
The two headlights and the rear light must turn ON and OFF alternatively (when headlights are ON, the rear light must be OFF and vice versa) for 1 second in each state.
• When the racer is inside the covered section: The two headlights must turn ON and OFF alternatively for 0.5 seconds in each state. The rear light must stay ON for the whole duration.
#include<stdio.h>
int main()
{
int i;
for(i = 0; i < 1000;i++)
{
printf("The two headlights are ON and the rear light is OFF\n");
Sleep(1);
printf("The two headlights are OFF and the rear light is ON\n");
}
return 0;
}
Comments
Leave a comment