Arithmetic and Relational Operators in C
Get Certified in C Programming and Take Your Skills to the Next Level
Program 1
#include<stdio.h>
#include<conio.h>
int main()
{
system("cls");
// Arithmetical operator + ,-, *,/%
float a;
a=15/2.0;
printf("%.1f",a);
// a=10;
// b=5;
// c=a+b;
// printf("\nAddition is %d: ",c);
// c=a-b;
// printf("\nSubtraction is %d: ",c);
// c=a*b;
// printf("\nMultiplication is %d: ",c);
// c=a/b;
// printf("\nDivision is %d: ",c);
// c=a%b;
// printf("\nMod Result %d: ",c);
// c=a%b;
return 0;
}
Program 2
// Relational Operator
// > < >= <= == !=
#include<stdio.h>
#include<conio.h>
int main()
{
system("cls");
int a,b,c,x;
printf("Enter two Number:");
scanf("%d %d",&a,&b);
c=(a==b);
printf("a==b %d",c);
c=(a!=b);
printf("\na!=b %d",c);
// //c=a>b;
// //c=a>=b;
// //c=(a<=b);
// c=(a==b);
// a=10;
// b=10;
// c=10;
// x=(a==b==c); // 1==10
// printf("%d",x);
}
If you are Happy with DataFlair, do not forget to make us happy with your positive feedback on Google

