Write a c program to check a voting AGE condition using conditional/ternary


Q1 Write a c program to check a voting AGE condition


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

/*
 *
 */
int main(int argc, char** argv)
{
    int a;
    printf("ENTER A AGE\n");
    scanf("%d",&a);
    a>17 ? printf("YOU CAN VOTE"): printf("YOU CAN'T VOTE");

   
    return (EXIT_SUCCESS);
}

Write a c program to check a voting AGE condition using conditional/ternary




Q2  WRITE A C PROGRAM  TO CHECK WEATHER RESULT

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

/*
 * 
 */
int main(int argc, char** argv)
{
    int a;
    printf("ENTER A result");
    scanf("%d",&a);
    a>32 ? printf("pass "): printf("Better luck next time");
  
      
    return (EXIT_SUCCESS);
}
Write a c program to check a voting AGE condition using conditional/ternary



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


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

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

Write a c program to check a voting AGE condition using conditional/ternary

Write a c program to check a voting AGE condition using conditional/ternary



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.

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