Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Level 6 lession 4 C programmming error

#include <stdio.h>

int main() {

/
Y for Yellow
G for Green
R for Red
/
char signal = 'Y';

if(signal=='Y')
{
printf("Wait");
}
else if(signal== 'G')
{
printf("GO");
}
else if(signal== 'R')
{
printf("Stop");
}
return 0;
}


error:-

Have you created the else if block for Yellow light?
by

1 Answer

sam5epi0l
Try this code:


#include <stdio.h>

int main() {

/
Y for Yellow
G for Green
R for Red
/
char signal = 'Y';

if(signal == 'G') {
printf("Go");
} else if(signal == 'Y') {
printf("Wait");
} else if(signal == 'R') {
printf("Stop");
}

return 0;
}

Login / Signup to Answer the Question.