You are on page 1of 4

Code for- Programming Language C C/C++/JAVA

HINDI IN C
C Operators
 Variables के अंदर values store करवाकर आप उन variables पर कई प्रकार के operations
perform कर सकते है ।
 उदहारण के लऱए दो integer variables के अंदर value store करवाकर आप addition का
operation perform कर सकते है और उन दोनों variables की values के sum को print
करवा सकते है । इसी प्रकार आप और भी अऱग अऱग operations variables के साथ perform
कर सकते है ।
 Variables के साथ operations perform करने के लऱए आपको अऱग अऱग operators यूज़
करने पड़ते है । इस chapter में आपको ऐसे ही operators के बारे में बताया जा रहा है ।
 Operations में operators के साथ जो variables यज़
ू होते है वो operand कहऱाते है ।
उदाहरण के लऱए नीचे ददए गए statement को दे खिये।

c = a + b;

उपर ददए गए statement में a और b को operator (+) के साथ यूज़ ककया गया है इसलऱए ये दोनों
variables operands कहऱायेंगे।
Operators 2 प्रकार के होते है ।
 Unary – इस प्रकार के operators लसर्फ एक ही operand के साथ यूज़ ककये जाते है ।
 Binary – इस प्रकार के operators के साथ 2 operands यूज़ ककये जाते है ।

Arithmetic Operators
 Arithmetic operators mathematical operations perform करने के लऱए यूज़ ककये जाते
है । जैसे की addition, subtraction, division और multiplication आदद। Arithmetic
operators 5 प्रकार के होते है । ये basic mathematical operators होते है ।
Operators Description
+ (Addition) ये operator दो variables की values को add करता है ।
– (Subtraction) ये operator एक variable की value में से दस ू रे variable की value
subtract करता है ।
* ये operator 2 variables की values को multiply करता है ।
(Multiplication)
/ (Division) ये operator एक variable की value से दस
ू रे variable की value को
divide करता है ।
% (Modulus) ये operator division के बाद शेष बची हुई value को प्राप्त करने के
लऱए यूज़ ककया जाता है ।

By Mr. UMESH KUMAR, MCA (GGU) Page | 1


Department of computer science and information technology
Code for- Programming Language C C/C++/JAVA

#include <stdio.h>
int main()
{
int a,b,c;
printf("Enter two numbers ");
scanf("%d%d",&a,&b);

c=a+b;
printf("Addition of a and b is %d\n",c);
c=a-b;
printf("Subtraction of a and b is %d\n",c);
c=a*b;
printf("Multiplication of a and b is %d\n",c);

c=a/b;
printf("Division of a and b is %d\n",c);

c=a%b;
printf("Remainder of a and b is %d\n",c);

return 0;
}

Output
Enter two numbers 5
4
Addition of a and b is 9
Subtraction of a and b is 1
Multiplication of a and b is 20
Division of a and b is 1
Remainder of a and b is 1

Assignment Operators
Assignment operators variables की values को एक दस
ू रे को assign करने के लऱए यूज़ ककये जाते
है । C language में यूज़ होने वाऱे ववलभन्न assignment operators के बारे में नीचे ददया जा रहा है ।
Operators Description
= ये operator right side के operand की value को left side के operand को
assign करता है ।
+= ये operator left side के operand में right side के operand की value को
add करके result left side वाऱे operand को assign करता है । इसे आप
इस प्रकार भी लऱि सकते है । a = a+b;

By Mr. UMESH KUMAR, MCA (GGU) Page | 2


Department of computer science and information technology
Code for- Programming Language C C/C++/JAVA

-= ये operator left side के operand की value में से right side के operand


की value को subtract करके result left side के variable में store करवाता
है । इसे आप इस प्रकार भी लऱि सकते है । a=a-b;
*= ये operator left side के operand की value को right side के operand की
value से multiply करके result को left side के operand में store करता
है ।
/= ये operator left operand की value को right operand की value से
divide करके result को left side के operand में store करता है ।
%= ये operator left side के operand की value को right side के operand की
value से divide करके शेष बचे हुए result को left side के operand में
store करता है ।

Source Code :
#include <stdio.h>
int main()
{
int a=20,b=12;
b = a + b;
printf("value of b is %d\n",b);
b += a;
printf("value of b is %d\n",b);
b -= a;
printf("value of b is %d\n",b);
b *= a;
printf("value of b is %d\n",b);
b /= a;
printf("value of b is %d\n",b);
b %= a;
printf("value of b is %d\n",b);
b &= 2;
printf("value of b is %d\n",b);
b |= 2;
printf("value of b is %d\n",b);
b ^= 2;
printf("value of b is %d\n",b);
b <<= 2;
printf("value of b is %d\n",b);
b >>= 2;
printf("value of b is %d\n",b);
return 0;

By Mr. UMESH KUMAR, MCA (GGU) Page | 3


Department of computer science and information technology
Code for- Programming Language C C/C++/JAVA

Output
value of b is 32
value of b is 52
value of b is 32
value of b is 640
value of b is 32
value of b is 12
value of b is 0
value of b is 2
value of b is 0
value of b is 0
value of b is 0

By Mr. UMESH KUMAR, MCA (GGU) Page | 4


Department of computer science and information technology

You might also like