Site icon DataFlair

Conditional Operator in C

Program 1

// Implementation of Conditional operator
// ? :

#include<stdio.h>
#include<conio.h>
int main()
{
    system("cls");
     char ch;
     printf("Enter a character: ");
     ch=getche();
     ch=='a'||ch=='e'||ch=='o'||ch=='i'||ch=='u' ||ch=='A'||ch=='E'||ch=='O'||ch=='I'||ch=='U'?printf("\nVowel"):printf("\nNot a Vowel");
    // int a,b,c,d,x,y,z;
    // printf("Enter four Number");
    // scanf("%d%d %d%d",&a,&b,&c,&d);
    // x=a>b?a:b;
    // y=c>d?c:d;
    // z=x>y?x:y;
    // printf("Grater no is %d: ",z);
    return 0;
}

 

Exit mobile version