Hello, i have to create a program for-
If the age is less than 18-You are still a kid
18-30 adult
30-60 middle age
greater than 60-senior citizen
else for any other impossible age (-ve or 0 age) ' wow '
Here is my attempt,
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
int n;
printf("Please enter your age ");
scanf("%d" , &n);
if (0<n<18) printf("You are still a kid");
else if (18<=n<30) {printf("You are an adult");
else if (30<=n<60) {printf("You are a middle-aged person");
else if (60<=n) {printf("You are a senior citizen");
else {printf("Wow !!!");
}
}
}
}
getch();
}
My compiler says 'Misplaced else'
Please help me find my mistake.
Thank you.