Search
 
SCRIPT & CODE EXAMPLE
 

C

Relational Operators in c

// Working of relational operators
#include <stdio.h>
int main()
{
    int a = 5, b = 5, c = 10;

    printf("%d == %d is %d 
", a, b, a == b);
    printf("%d == %d is %d 
", a, c, a == c);
    printf("%d > %d is %d 
", a, b, a > b);
    printf("%d > %d is %d 
", a, c, a > c);
    printf("%d < %d is %d 
", a, b, a < b);
    printf("%d < %d is %d 
", a, c, a < c);
    printf("%d != %d is %d 
", a, b, a != b);
    printf("%d != %d is %d 
", a, c, a != c);
    printf("%d >= %d is %d 
", a, b, a >= b);
    printf("%d >= %d is %d 
", a, c, a >= c);
    printf("%d <= %d is %d 
", a, b, a <= b);
    printf("%d <= %d is %d 
", a, c, a <= c);
  
//Output

//5 == 5 is 1
//5 == 10 is 0
//5 > 5 is 0
//5 > 10 is 0
//5 < 5 is 0
//5 < 10 is 1
//5 != 5 is 0
//5 != 10 is 1
//5 >= 5 is 1
//5 >= 10 is 0
//5 <= 5 is 1
//5 <= 10 is 1 
    return 0;
}
Comment

logical operators in c

Logical Operators: 
They are used to combine two or more conditions/constraints or to complement 
the evaluation of the original condition under consideration. They are 
described below: 
 

Logical AND operator: The ‘&&’ operator returns true when both the conditions 
under consideration are satisfied. Otherwise it returns false. For example, a
&& b returns true when both a and b are true (i.e. non-zero).

Logical OR operator: The ‘||’ operator returns true even if one (or both) of
the conditions under consideration is satisfied. Otherwise it returns false. 
For example, a || b returns true if one of a or b or both are true 
(i.e. non-zero). Of course, it returns true when both a and b are true.

Logical NOT operator: The ‘!’ operator returns true the condition in 
consideration is not satisfied. Otherwise it returns false. For example, 
!a returns true if a is false, i.e. when a=0.
Comment

Logical Operator in C language

#include<stdio.h>
int main(){
  A = 5;
  B = 10;
if((A == 5) && (B < 11)){
 printf(“Both conditions are ture”);
}

if(!(A==5)){
 printf(“A is not equal to 5”);
}

if((A>=3) ||(B<=9)){
 printf(“min any one condition is true”);
}

}
Comment

PREVIOUS NEXT
Code Example
C :: size of int in c 
C :: get docker 
C :: c programming programiz 
C :: increment pointer value in c 
C :: C Syntax of goto Statement 
C :: what is %d in C 
C :: c read file from command line 
C :: arduino dont working dc motor 
C :: C Syntax of return statement 
C :: printing a string with putchar 
C :: count number of items using delimiter 
C :: find all hyperlinks <a in p tag 
C :: C Keyword typedef 
C :: create a gtk window 
C :: scranton inhabitants 
C :: c enums 
C :: first come first serve 
C :: java Node<E 
C :: Macro definition and expansion 
C :: switch every right 4 bit with the left 4 bits 
C :: data breach 
C :: write the data in perticulare memmory loaction in C 
C :: write a ppm image 
C :: too many arg 
C :: string once declared 
C :: scanf autotrash c 
C :: c if statement 
C :: c check if is a right triangle 
Dart :: asset image in circle avatar flutter 
Dart :: flutter print type 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =