How can i make a small program in C language...under which a person has to enter his age...and if the entered age is between 17 and 19...then a message appears-"You are elligible for this exam"?
Answers
Answered by
1
Answer:
#include<stdio.h>
#include<conio.h>
void main()
{
int age;
printf("Enter the age: ");
scanf("%d",&age);
for( i = 17; i <= 19 ; ++i )
{
if( age == i )
{
printf( "\n You are eligible for this exam " );
}
}
}
Explanation:
1. scanf gets the value from user and stores it in the variable age.
2. for loop creates a range from 17 to 19.
3. if condition chech the age falls in the range 17-19
Similar questions
Physics,
6 months ago
Physics,
6 months ago
Environmental Sciences,
6 months ago
Biology,
1 year ago
Social Sciences,
1 year ago
Math,
1 year ago
Science,
1 year ago