Home » » Operators in c programming with Example

Operators in c programming with Example

Operators in c programming with Example


Operators in c programming with Example

     There are many operators in c language.
1. Arithematic operator [ +, -, *, /, % ]
2. Relational Operator [ <, >, <=, >=, ==, != ]
3. Increment Operator [ ++ ]
4. Decrement Operator [ -- ]
5. Assignment Operator [ +=, -=, *=, /=, %= ]
6. Bitwise Operator [ &&, || ]
7. Logical Operator [ &&, || ]

Program 1:

#include 
int main()
{
int a;
printf("Enter the value of a is :");
scanf("%d", &a);
a++;
a--;
printf("The value of a is %d" ,a );
return 0;
}

Output 1:


Enter the value of a is :1
The value of a is 1
program 2:


#include
int main()
{
int a,b,c,d;
printf("Enter the value of a,b,c,d is :");
scanf("%d%d%d%d", &a,&b,&c,&d);
a+=100;
a-=100;
c*=100;
d%=100;
printf("\nThe value of a is %d" ,a );
printf("\nThe value of b is %d" ,b );
printf("\nThe value of c is %d" ,c );
printf("\nThe value of d is %d" ,d );
return 0;
}

Output 2:


Enter the value of a,b,c,d is :1
2
3
4
The value of a is 1
The value of b is 2
The value of c is 300
The value of d is 4

0 coment�rios:

Post a Comment

Link you don't want to vouch for Read more: https://html.com/seo/#ixzz5zVltiZ5g