सीधे मुख्य सामग्री पर जाएं

conditional statement in hindi | conditional statement examples

 आज हम conditional statement in hindi और conditional statement examples के बारे में जानेगे क्या होता हैconditional statement in hindi तो चलिए शुरु करते हैं:-

conditional statement in hindi:-

कभी - कभी ऐसे प्रोग्राम भी बनाए जाते हैं जिनमें आउटपुट दो प्रकार का होता है । यह आउटपुट किसी कंडीशन पर निर्भर करता है । कंडीशन के सही या : गलत होने पर आउटपुट अलग - अलग होते हैं । कंडीशन के सही होने पर सही वाले ब्लॉक का आउटपुट प्रदर्शित होगा , वही कंडीशन के गलत होने पर गलत वाले ब्लॉक का आउटपुट प्रदर्शित होगा । 
types of conditional statement:-

( i ) if statement in c in hindi 
( ii ) Do case 

(i) if statement in hindi: -

यह एक conditional statement  है । इसके अन्तर्गत एक या एक से अधिक कंडीशन्स को लिखा जा सकता है । एक ही स्टेटमेन्ट में एक से अधिक कंडीशन्स के लिए लॉजिकल ऑपरेटर्स का प्रयोग किया जाता है । एक या दो प्रकार की कंडीशन्स के लिए if ....... else ....... end if का प्रयोग किया जाता है तथा अलग - अलग प्रकार की कंडीशन्स को nested if के द्वारा लिखा जा सकता है । nested if में if के अन्दर एक और if को लिखा जाता है । इसका Syntax हैं  : 

( a ) Syntax of if ....... else ........ endif

If <condition >
               <Statements>
else 
              <Statements>
ended
if statement in c in hindi



If statment Example: Write a program to input age from the user and chck the user is eligible for voting or not. 
Set Talk off 
Clear 
Store 0 to a 
input "Enter your age " to a 
if a >= 18 
            ? "Eligible for voting" 
else  
            ? "Not eligible for voting" 
endif 
 Set Talk on 
Output- 
Enter your age 17 
Not eligible for voting 

(b) Syntax of Nested if :- Method - 1

if< Condition 1>
                 if <Cordition 2>
                  <Statement>
Else
                  <Statement>
Endif 
                 <Statement>
Else
                 <Statement>
Endif

Syntax of Nested if :- Method -2 

if < Condition 1> 
              <Statement> 
Else 
               if <Condition 2> 
                            <Statement> 
               Else  
                            <Statement>
Endif 
Endif
conditional statement in hindi | conditional statement examples



If statement Example :- Accept Post from User and Print salary according to the following :- 
(i) if Post is Manager Sal = 20,000/- 
(ii) if Post is Executive Sal = 10,000/- 
(iii) if Post is Trainee Sal = 7000/-
Set Talk off 
Clear 
store null to p 
Accept "Enter Your Post " to P

if upper (P) = "MANAGER"
? "Salary is 20,000" 
else 
   if upper (P) = "EXECUTIVE" 
                ? "Salary is 10,000" 
else 
                 if upper (P) = "TRAINEE" 
                                 ? "Salary is 7,000"
else 
                                 ? "Wrong Post" 
                      Endif 
          Endif 
Endif 
Set talk on
Output 
Enter Your Post executive 
Salary is 10000

Do case ....... end case:-

यह स्टेटमेन्ट Multiway स्टेटमेन्ट है । इसमें दिए गए इनपुट को प्रोग्राम में लिखे गए Case से मिलाया जाता है । कन्डीशन का मिलान जिस Case से हो जाता है । उस Case में लिखे स्टेटमेन्ट एक्जीक्यूट हो जाते हैं । इसका सिन्टैक्स इस प्रकार है: 

Syntax:-       Do Case

                                       Case <Condition 1>                                                              <Satement> 
                                       Case <Condition 2>                                                               <Satement>  
                                       Case <Condition 3>                                                               <Satement> 
                                       Case n... 
                        otherwise 
                                        <Statement>
                         End case
conditional statement in hindi | conditional statement examples



Example :- Write a program which takes number from 1 to 5 and print this number in a character format 
Set talk off
Clear
Store 0 to num 
Input "Enter a Number " to num
Do Case
      Case num = 1
                  a = "one
      Case num = 2 
                  a = "two"
      Case num = 3
                  a = "three"
      Case num = 4
                  a = "four"
      Case num = 5
                  a = "five"
Otherwise 
    ? "Number is Not Between 1 to 5"
EndCase 
     ? "Character format of your number is - ",a
Set talk on
Output :-
Enter a Number 3
Character format of your number is - three


टिप्पणियाँ

इस ब्लॉग से लोकप्रिय पोस्ट

Query Optimization in hindi - computers in hindi 

 आज  हम  computers  in hindi  मे query optimization in dbms ( क्वैरी ऑप्टीमाइजेशन) के बारे में जानेगे क्या होता है और क्वैरी ऑप्टीमाइजेशन (query optimization in dbms) मे query processing in dbms और query optimization in dbms in hindi और  Measures of Query Cost    के बारे मे जानेगे  तो चलिए शुरु करते हैं-  Query Optimization in dbms (क्वैरी ऑप्टीमाइजेशन):- Optimization से मतलब है क्वैरी की cost को न्यूनतम करने से है । किसी क्वैरी की cost कई factors पर निर्भर करती है । query optimization के लिए optimizer का प्रयोग किया जाता है । क्वैरी ऑप्टीमाइज़र को क्वैरी के प्रत्येक operation की cos जानना जरूरी होता है । क्वैरी की cost को ज्ञात करना कठिन है । क्वैरी की cost कई parameters जैसे कि ऑपरेशन के लिए उपलब्ध memory , disk size आदि पर निर्भर करती है । query optimization के अन्दर क्वैरी की cost का मूल्यांकन ( evaluate ) करने का वह प्रभावी तरीका चुना जाता है जिसकी cost सबसे कम हो । अतः query optimization एक ऐसी प्रक्रिया है , जिसमें क्वैरी अर्थात् प्रश्न को हल करने का सबसे उपयुक्त तरीका चुना

acid properties in dbms - computers in hindi

 आज हम computers in hindi के अन्दर Properties of Transaction (acid properties in dbms) के बारे मे जानेगे क्या होता है तो चलिए शुरु करते हैं:- Properties of Transaction ( कार्यसम्पादन के गुण ) (ACID in hindi) :- Atomicity , Consistency , Isolation , Durability - ACID सामान्यत : किसी transaction की 4 प्रॉपर्टीज़ होती हैं-  1. Atomicity  2. Consistency  3. Isolation  4. Durability  1. Atomicity transaction :-   Atomicity transaction की प्रॉपर्टी के द्वारा यह comfirm किया जाता है की transaction   के द्वारा किए जाने वाले सभी ऑपरेशन पूर्ण होंगे या उनमें से एक भी execute नहीं होगा । इसमें transaction के प्रत्येक ऑपरेशन को एक अकेली यूनिट की भांति व्यवहार किया जाता है । आइए इसे एक example की सहायता से समझते हैं। acid properties with example :-  यदि प्रथम ऑपरेशन सफल पूर्ण हो जाए तथा द्वितीय ऑपरेशन पर आते ही transaction असफल अर्थात् फेल हो जाए तो ऐसी स्थिति में प्रथम ऑपरेशन भी rollback हो जाएगा । Atomicity को transaction manager के द्वारा नियंत्रित किया जाता है । transaction manager डेटाबेस