![]() |
conditional operators in c |
#why use conditional operator
check result is true or false- 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.
- Consider if else condition . there are some conditional operator
>,<,<=,>=, !=, && there are many conditional operators in c. - If you find a median numbers of three variables you need conditional operators
- Find the larger number in array
- Find the prime number 1 to 1000
#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