Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


C Programming Code Examples

Learn C Language

Relational Operators in C Programming Language

Relational Operators in C
Relational Operators are the operators used to create a relationship and compare the values of two operands. For example, there are two numbers, 5 and 15, and we can get the greatest number using the greater than operator (>) that returns 15 as the greatest or larger number to the 5. Following are the various types of relational operators in C.
==
Equal To Operator (==) is used to compare both operands and returns 1 if both are equal or the same, and 0 represents the operands that are not equal.
!=
Not Equal To Operator (!=) is the opposite of the Equal To Operator and is represented as the (!=) operator. The Not Equal To Operator compares two operands and returns 1 if both operands are not the same; otherwise, it returns 0.
<
Less than Operator (<) is used to check whether the value of the left operand is less than the right operand, and if the statement is true, the operator is known as the Less than Operator.
>
Greater than Operator (>) checks the value of the left operand is greater than the right operand, and if the statement is true, the operator is said to be the Greater Than Operator.
<=
Less than Equal To Operator (<=) checks whether the value of the left operand is less than or equal to the right operand, and if the statement is true, the operator is said to be the Less than Equal To Operator.
>=
Greater than Equal To Operator (>=) checks whether the left operand's value is greater than or equal to the right operand. If the statement is true, the operator is said to be the Greater than Equal to Operator.
/* relational operators in C */ #include <stdio.h> main() { int a = 23; int b = 9; int c ; if( a == b ) { printf("Line 1 - a is equal to b\n" ); } else { printf("Line 1 - a is not equal to b\n" ); } if ( a < b ) { printf("Line 2 - a is less than b\n" ); } else { printf("Line 2 - a is not less than b\n" ); } if ( a > b ) { printf("Line 3 - a is greater than b\n" ); } else { printf("Line 3 - a is not greater than b\n" ); } /* Lets change value of a and b */ a = 5; b = 20; if ( a <= b ) { printf("Line 4 - a is either less than or equal to b\n" ); } if ( b >= a ) { printf("Line 5 - b is either greater than or equal to b\n" ); } }



Two stacks to store two ends of the list in C. Entering elements in the array. Set top to stack. To print the sorted array. Enter the no of elements in the array. Enter the elements


First give a meaningful name to the recursive function to print even odd numbers. Let's say printEvenOdd(). This function can print both even as well as Odd Numbers in given range.




C language encrypting and decrypting files. So as to change enter file path. Enter password. Open a file to store decoded data. Until end of file to be encrypted read each...


C Language program code sample input any number and check whether the given number is even or odd using bitwise operator. How to check whether a number is even or odd using