Computer Science, asked by saumytiwarI, 1 year ago

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 rogan21
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