Arithmetic and Relational Operators with example in C programming
Arithmetic (+,-,/,%)
Arithmetic Operators in C |
The arithmetic operators are the symbols that are used to perform basic mathematical operations like addition , subtraction, multiplication, division and percentage modulo.
Example-Write a program to perform all Arithmetic operation in c language
Program for Arithmetic operation
#include <stdio.h>
void main()
{ int a, b;
printf("Enter the valur of the two number for performing the arithmatic opertion \n");
printf("Enter the frist number a::");
scanf("%d",&a);
printf("Enter the second number of the b::");
scanf("%d",&b);
printf("Arithmetic operator in C \n");
printf("this is value of a+b is %d",a+b);
printf("\nthis is value of a-b is %d",a-b);
printf("\n this is value of a*b is %d",a*b);
printf("\n This is value of a/b is %d",a/b);
}
output-
Relation Operators(<,>,<=,>=.==,!=)
Operator | Meaning of Operator | Example |
---|---|---|
== | Equal to | 5 == 3 is evaluated to 0 |
> | Greater than | 5 > 3 is evaluated to 1 |
< | Less than | 5 < 3 is evaluated to 0 |
!= | Not equal to | 5 != 3 is evaluated to 1 |
>= | Greater than or equal to | 5 >= 3 is evaluated to 1 |
<= | Less than or equal to | 5 <= 3 is evaluated to 0 |
Example- write a code to find the relation operators
output-
Comments
Post a Comment