Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

(a)Write a C Program to Find the Eligibility of a Person to Vote or Not?

EX.NO:2a PROGRAMS USING DECISION-MAKING CONSTRUCTS

DATE:

AIM:
To Write a C Program to find the eligibility of a Person to Vote or not?

ALGORITHM:
1.Start the program.
2.Read name, age.
3.IF age>=18 print “Eligible”.
4.ELSE print “Not Eligible”.
5.ENDIF.
6.Stop the Program.

PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
{
int age;
char name[50]; // or *name
clrscr();
printf("\n Type the Name of the candidate: ");
gets(name);
printf("\n Enter The Age : ");
scanf("%d",&age);
if(age>=18)
printf("\n %s is Eligible for Vote",name);
else
printf("\n %s is Not Eligible for Vote",name);
getch();
}
RESULT:
Thus the program to find the eligibility of a Person to Vote or not was executed and the
output was verified.

You might also like