Write a c program to check a voting AGE condition using if-else


Q1 Write a c program to check a voting AGE condition


Given age of someone and that we ought to check whether person is eligible for voting or not.

To check that someone is eligible for voting or not, we'd like to examine whether or not person’s age is bigger than or up to eighteen. For this we tend to are reading age in a very variable a and checking the condition a>=18, if the condition is true, "person are eligible for voting" else no.




#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv)
{
   
    int a;
    printf("ENTER A AGE\n");
    scanf("%d",&a);
    if (a>=18)
    {
        printf("YOU CAN VOTE");
       
    }
    else
    {
        printf("YOU CAN'T VOTE");
       
    }
     
    return (EXIT_SUCCESS);
}

Write a c program to check a voting AGE condition using if-else

Write a c program to check a voting AGE condition using if-else


Q2  WRITE A C PROGRAM  TO CHECK WEATHER RESULT


The Given marks of student and that we ought to check whether student is pass or fail.

To check that student  is pass or fail ,we'd like to examine whether or not student marks is greater then or up to thirty-three. For this we tend to are reading marks in a very variable a and checking the condition a>=33, if the condition is true, "student is pass or fail.

ANS - 
#include <stdio.h>
#include <stdlib.h>

/*
 *
 */
int main(int argc, char** argv)
{
    int a;
    printf("ENTER A RESULT\n");
    scanf("%d",&a);
    if(a>=33)
    {
       printf("pass ");
    }
    else
    {
        printf("pending");
    }

   
    return (EXIT_SUCCESS);
}

Write a c program to check a voting AGE condition using if-else



Q3-Write a program to check weather a number  is positive or negative

ANS -

#include <stdio.h>
#include <stdlib.h>

/*
 * 
 */
int main(int argc, char** argv)
{
    int a;
    printf("ENTER A NUMBER\n");
    scanf("%d",&a);
    if(a>=0)
    {
       printf("positive ");
    }
    else
    {
        printf("negative");
    }
  
      
    return (EXIT_SUCCESS);
}

Write a c program to check a voting AGE condition using if-else

Write a c program to check a voting AGE condition using if-else


Comments

Popular posts from this blog

Create a structure TIME with members hours, minutes and seconds. Write a C program to add two time objects by passing structure variables to function and display result in H: M: S format.

Create a structure named company which has name, address, phone and no of Employee as member variables. Read name of company, its address, phone and no of Employee. Finally display these members’ value.