top of page

Multiple Decisions क्या होते हैं?

  • Writer: Siddharth Sharma
    Siddharth Sharma
  • Oct 7, 2025
  • 2 min read

जब प्रोग्राम को एक से अधिक conditions के आधार पर अलग-अलग actions लेने होते हैं, तब multiple decisions की जरूरत होती है। इसे decision-making का complex form कहा जा सकता है जहाँ दो से अधिक विकल्पों में से सही विकल्प चुनना होता है।


Control Structure में Multiple Decisions कैसे handle करें?

यह काम else-if ladder या else-if chain के जरिए किया जाता है। इसमें एक से अधिक conditions एक के बाद एक चेक होती हैं और जो पहली true condition मिलती है, उसका संबंधित code execute होता है।

Syntax:

if (condition1) {
    // condition1 true होने पर यह code चलेगा
} else if (condition2) {
    // condition2 true होने पर यह code चलेगा
} else if (condition3) {
    // condition3 true होने पर यह code चलेगा
} else {
    // अगर सभी conditions false हों तो यह code चलेगा
}

Example:

int marks = 85;
if (marks >= 90) {
    printf("Grade: A");
} else if (marks >= 75) {
    printf("Grade: B");
} else if (marks >= 50) {
    printf("Grade: C");
} else {
    printf("Grade: F");
}

यहाँ, marks के आधार पर multiple decisions लिए गए हैं और grade assign किया गया है।


उपयोग:

  • Multiple categories या levels में निर्णय लेने के लिए।

  • बड़े decision trees को manage करने में सहायक।

  • Complex conditions को आसान और readable बनाता है।

इस प्रकार multiple decisions programming में decision-making को flexible और powerful बनाते हैं, जिससे program कई विकल्पों को आसानी से संभाल सकता है.### Control Structure: if-statement, if-else, multiple decisions, nested if statementsgeeksforgeeks+2


if-statement:

  • यह एक conditional control structure है जिसमें कोई एक condition दी जाती है।

  • यदि वह condition true होती है, तो if-block का code execute होता है, अन्यथा skipped होता है।

  • उदाहरण:

if (num > 5) {
  printf("Number is greater than 5");
}

if-else statement:

  • यह निर्णय लता है कि condition true या false होने पर कौन-सा code चलेगा।

  • यदि condition true हो तो if-block चलेगा, परन्तु यदि false हो तो else-block execute होगा।

  • उदाहरण:

if (age >= 18) {
  printf("Eligible to vote");
} else {
  printf("Not eligible to vote");
}

multiple decisions (else-if ladder):

  • कई conditions को एक क्रम में जांचने के लिए else-if का उपयोग होता है।

  • पहली true condition वाले block का code execute होगा, अन्य conditions ignore होंगी।

  • उदाहरण:

if (marks >= 90) {
  printf("Excellent");
} else if (marks >= 75) {
  printf("Very Good");
} else if (marks >= 50) {
  printf("Good");
} else {
  printf("Needs Improvement");
}

flow chart of Multiple Decisions
flow chart of Multiple Decisions

nested if statements:

  • एक if या else block के अंदर दूसरी if statement हो, इसे nested if कहते हैं।

  • इससे multi-level decision making होती है।

  • उदाहरण:

if (x > 10) {
  if (y > 20) {
    printf("x > 10 and y > 20");
  }
}

सारांश:

  • if statement simple single condition के लिए है।

  • if-else से 2 विकल्पों में से निर्णय होता है।

  • multiple decisions (else-if ladder) से कई विकल्पों का परीक्षण होता है।

  • nested if से multi-level निर्णय संभव होता है।

ये सभी control structures प्रोग्राम की flow को नियंत्रित करते हैं और decision-making को सहज बनाते हैं।

 
 
 

Comments


bottom of page