Rotate your phone or change to desktop for better experience

Rotate your phone or change to desktop for better experience

program to read name and age from user and show if the person is eligible to vote or not

 #include<stdio.h>


    int main(){


    int age;

    char name[20];


    printf("enter yout name\n");

    scanf("%s",name);


    printf("enter your age : ");

    scanf("%d",&age);


 printf("---------------------------------------------------------------------------------------------------------\n");


   if ( age >= 18 && age <= 80)

   {

       printf("%s your age is %d so you are eligible to vote\n",name,age);

   }

   else 

   {

       printf("%s your age %d you are not eligible to vote\n",name,age);

   }

    return 0;

}

Post a Comment

0 Comments