Friday, May 10, 2019

conditional operators in c | importance of conditional operator

conditional operators in c
conditional operators in c

conditional operator in c , conditional operator is one of the crazy and cool operator in c program.So This operator work only true or false. Because Program know true or false. Here i explain you why we used conditional operator.

#why use conditional operator

check result is true or false
  1. a = 10, b= 5 here a > b is condition is true or false . So here a is greater than b so the condition is one means true if we told b is greater than a this condition is false a.
  2. Consider if else condition . there are some conditional operator
    >,<,<=,>=, !=, && there are many conditional operators in c.
  3. If you find a median numbers of three variables you need conditional operators
  4. Find the larger number in array 
  5. Find the prime number 1 to 1000 
So therefor we used this conditional operator.

 #EXAMPLE conditional operators in c

#include <stdio.h>
int main(){
    int a=10,b=5;
    if(a == 10){
     printf("Programizbasic.blogspot.com");
}else{ printf("Not true") }
return 0;
}

Learn basic programming in c click here








No comments:

Post a Comment

Post Top Ad

Pages