Write a C Program For Check You Are Eligible For Voting Or Not .
Logic :
This problem may be different for different-2 Country ,In INDIA Voting age is 18 Years .So simple if age is equal or greater then 18 than then you are eligible for vote and if less than you are not mature according to Indian Government or age is 100 and above then rest no need to vote take a rest .
#include<stdio.h>
int main ()
{
int age,temp=0 ;;
while(1)
{
printf("Enter Your Age Here\n");
scanf("%d",&age);
if( age >= 18 && age<100 )
{
printf("Congratulation !!! You Are Eligible For Voting\n\n" );
}
else if( age >= 100 )
{
printf("You Are Eligible But We Suggest Take a Rest\n\n" );
}
else if(age<18)
{
temp = 18 - age;
printf("You Not Are Eligible or You are Not Mature \n\n" );
printf("Wait %d Years For Vote .\n",temp );
}
}
return 0;
}
Output:
Enter Your Age Here
21
Congratulation !!! You Are Eligible For Voting
Enter Your Age Here
101
You Are Eligible But We Sugget Take a Rest
Enter Your Age Here
15
You Not Are Eligible or You are Not Mature
wait 3 Years For Vote
Enter Your Age Here