Monday, 7 March 2016

C Program For Check You Are Eligible For Voting Or Not

Problem :- 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 .

Try Yourself C Program To Find Character Is Vowel Or Not

Solution :-

#include<stdio.h>
int main ()
{
  //Ghanendra Yadav
    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:-

C Program For Check You Are Eligible For Voting Or Not

No comments:
Write comments

Recommended Posts × +