Notes in Hindi

What are Arithmetic Operators in C Language in Hindi

/ BCA / Programming with C and CPP

Arithmetic Operators in C Language in Hindi

What are Arithmetic Operators in C Language in Hindi

C Language में Arithmetic Operators का उपयोग संख्यात्मक गणनाएँ (जैसे जोड़, घटाव, गुणा, भाग आदि) करने के लिए किया जाता है। ये Operators हमें variables और constants पर गणितीय क्रियाएँ करने की सुविधा देते हैं। ये Programming की Basic और सबसे ज़रूरी अवधारणा (concept) है। जब भी हमें दो या दो से अधिक numbers के बीच कोई गणना करनी होती है, तब हम Arithmetic Operators का उपयोग करते हैं।

उदाहरण के लिए यदि हमारे पास दो संख्याएँ हैं – a और b, और हमें इनका योग, अंतर, गुणनफल या भाग निकालना है तो हम Arithmetic Operators का प्रयोग करेंगे। C Language में कुल 5 मुख्य Arithmetic Operators होते हैं।

Features of Arithmetic Operators

  • ये सभी Operators Binary होते हैं (मतलब दो operands पर काम करते हैं)।
  • कुछ operator जैसे ++ और -- Unary भी हो सकते हैं।
  • Arithmetic Operators integer, float और double जैसे सभी numeric types पर काम करते हैं।

Types of Arithmetic Operators in C with examples in Hindi

C Language में मुख्यतः 5 प्रकार के Arithmetic Operators होते हैं, जिन्हें हम नीचे table के माध्यम से समझ सकते हैं –

Operator Name Use Example
+ Addition जोड़ने के लिए a + b
- Subtraction घटाने के लिए a - b
* Multiplication गुणा करने के लिए a * b
/ Division भाग देने के लिए a / b
% Modulus शेषफल निकालने के लिए a % b

Examples in C

#include <stdio.h>
int main() {
  int a = 10, b = 3;
  printf("Addition = %d\n", a + b);
  printf("Subtraction = %d\n", a - b);
  printf("Multiplication = %d\n", a * b);
  printf("Division = %d\n", a / b);
  printf("Modulus = %d\n", a % b);
  return 0;
}

Output: Addition = 13 Subtraction = 7 Multiplication = 30 Division = 3 Modulus = 1

Use of Arithmetic Operators in Expressions in Hindi

Arithmetic Operators का उपयोग हम Expressions में करते हैं। एक Expression ऐसा statement होता है जिसमें एक या अधिक variables, constants और operators होते हैं और जिसका उद्देश्य कोई calculation करना होता है।

Expression का Syntax:

result = operand1 operator operand2;

नीचे कुछ उदाहरण दिए गए हैं:

  • sum = a + b; → यहाँ a और b operand हैं, + operator है और sum result है।
  • avg = (x + y + z) / 3; → यह expression तीन संख्याओं का average निकालता है।

Operators के साथ Expressions कैसे काम करते हैं?

  • Compiler पहले parentheses को evaluate करता है।
  • फिर operator precedence के अनुसार बाकी operators को process करता है।

Example:

int a = 8, b = 4, c;
c = a * b + 2;
printf("%d", c); // Output: 34

यहाँ पहले a * b (8 * 4 = 32) होगा फिर +2 किया जाएगा। इसलिए result होगा 34।

Rules for Arithmetic Operation Evaluation in Hindi

C Language में Arithmetic Operators को evaluate करने के कुछ नियम होते हैं जिनसे यह निर्धारित होता है कि कौन-से operator पहले execute होंगे और कौन बाद में। यह Operator Precedence और Associativity के द्वारा तय होता है।

Operator Precedence (Operator की प्राथमिकता)

Operator Precedence यह निर्धारित करता है कि expression में कौन सा operator पहले चलेगा।

Operator Precedence Level Associativity
* / % Higher Left to Right
+ - Lower Left to Right

इसका मतलब है कि यदि किसी expression में * और + दोनों हैं, तो पहले * evaluate होगा।

Example:

int result;
result = 10 + 2 * 3;
printf("%d", result); // Output: 16

यहाँ पहले 2 * 3 = 6 होगा फिर 10 + 6 = 16 किया जाएगा।

Associativity

Associativity यह तय करता है कि जब एक जैसे precedence वाले operators एक expression में हों, तो किस direction में उन्हें evaluate किया जाएगा – Left से Right या Right से Left।

  • + - * / % सभी की associativity Left to Right होती है।

Type Conversion

यदि expression में int और float दोनों प्रकार के operands हों, तो C Language type conversion करती है। इसे Implicit Type Conversion कहते हैं।

int a = 5;
float b = 2.5;
float result = a + b; // result will be 7.5

यहाँ a को पहले float में convert किया जाएगा फिर b से जोड़ा जाएगा।

Parentheses का प्रयोग

यदि आप चाहते हैं कि कोई विशेष भाग पहले solve हो तो आप parentheses () का उपयोग कर सकते हैं। यह programmer को control देता है कि किस part को पहले evaluate किया जाए।

int result = (10 + 2) * 3; // Output: 36

यहाँ पहले 10+2 होगा फिर उसका multiplication 3 से किया जाएगा।

FAQs

Arithmetic Operators वे symbols होते हैं जो दो values या variables के बीच गणितीय क्रियाएँ जैसे जोड़, घटाव, गुणा, भाग आदि करने के लिए उपयोग किए जाते हैं। जैसे +, -, *, / और %।
C Language में कुल 5 प्रकार के Arithmetic Operators होते हैं: Addition (+), Subtraction (-), Multiplication (*), Division (/), और Modulus (%)।
% operator दो संख्याओं के भाग के बाद बचा हुआ शेषफल निकालने के लिए प्रयोग किया जाता है। उदाहरण: 10 % 3 का result होगा 1।
C Language में * (Multiplication), / (Division), और % (Modulus) की precedence + और - की तुलना में अधिक होती है। इसलिए ये पहले evaluate होते हैं।
हाँ, C Language में Arithmetic Operators को float, double जैसे decimal numbers के साथ भी इस्तेमाल किया जा सकता है। ये automatically type conversion भी करते हैं जब जरूरत होती है।

Please Give Us Feedback