control statements(structures) in hindi(कण्ट्रोल स्टेटमेंट्स क्या है?):-
प्रोग्रामिंग भाषा में, प्रोग्राम के execution के flow को नियंत्रित करने के लिए जो स्टेटमेंट्स या structures प्रयोग किये जाते है उन्हें control statements(structures) कहते है.
control statements दो प्रकार के होते है:-
1:-conditional statements
2:-loop statements
1:-conditional statements:-
ये निम्नलिखित प्रकार के होते है.
(a):-if statement:-
if statement एक control statement है जिसका प्रयोग एक विशेष कंडीशन को test करने के लिए किया जाता है. इसमें कंडीशन केवल एक बार execute होती है जब कंडीशन सत्य होती है.
syntax-
if(condition)
{
statements
}
Fig:+if फ्लो चार्ट
(b):–if-else statements:-
किसी विशेष कंडीशन को test करने के लिए if-else statement का प्रयोग किया जाता है. यदि कंडीशन सत्य है तो if statement को execute किया जाता है अगर कंडीशन असत्य है तो else statement को execute किया जाता है.
syntax-
if(condition)
{
statement
}
else
{
statement
}
fig:-if else flow chart
(c):- switch statements:-
switch statement एक multi-way branch स्टेटमेंट है.
यह statement भी एक selection स्टेटमेंट जो कि एक प्रोग्राम के execution के लिए विभिन्न paths को डिफाइन करता है.
यह if-else स्टेटमेंट के लिए विकल्प के तौर पर कार्य करता है.
syntax:-
switch(variable)
{
case constant 1;
statements(s);
break:
case constant 2;
statement(s);
break;
case constant 3;
statement(s);
break;
———–
default
statement(s);
}
Fig:-switch statement flowchart
(2):-Loop statements(लूप स्टेटमेंट्स):-
loops के द्वारा हम किसी एक स्टेटमेंट या बहुत सारें स्टेटमेंट्स को एक से ज्यादा बार execute कर सकते है जब तक कि condition को प्राप्त नहीं कर लिया जाता.
loops स्टेटमेंट निम्लिखित प्रकार के होते है:-
1:-while loop
2:-do-while loop
3:-for loop
1:-while loop:-
while loop एक entry-controlled लूप है. इसमें स्टेटमेंट तब तक लगातार execute होते रहता है जब तक कि एक condition सत्य(true) नहीं हो जाती है. यह सबसे पहले condition की जांच करती है और बाद में स्टेटमेंट को execute करती है.
syntax:-
while(condition)
{
statement1;
statement2;
————-
}
Fig:-while loop flowchart
2:-do-while loop:-
यह loop एक exit-controlled लूप है. यह लूप भी while लूप की तरह ही है परन्तु यह पहले स्टेटमेंट को execute करता है तथा बाद में condition की जांच करता है.
यह loop यह सुनिश्चित करता है कि प्रोग्राम को कम से कम एक बार execute किया गया है.
syntax:-
do
{
Statement1;
Statement2;
————–
}
While (condition);
Fig:-while loop flowchart
3:- For loop:-
यह एक entry controlled लूप है. इसमें स्टेटमेंट तब तक execute होता है जब तक कि condition सत्य नही हो जाती है. यह loop तीन घटकों initialization स्टेटमेंट, boolean स्टेटमेंट तथा increment/decrement स्टेटमेंट से मिलकर बना होता है.
syntax:-
for(initial condition, test condition; incrementor or decrementor)
{
statement1;
statement2;
}
Fig:-for loop flowchart
अन्य स्टेटमेंट्स:- इनके अलावा कुछ और भी स्टेटमेंट्स है जो निम्न है:-
1:- Break statement
2:- Continue statement
1:-Break statement:-
इस स्टेटमेंट का प्रयोग switch स्टेटमेंट में स्टेटमेंट के अनुक्रम(sequence) को समाप्त करने के लिए किया जाता है तथा किसी loop को तुरंत exit करने के लिए किया जाता है.
syntax:- break;
2:-continue statement:-
continue स्टेटमेंट का प्रयोग तब किया जाता है जब हम loop को लगातार अगले iteration के साथ run करना चाहते है तथा वर्तमान iteration के लिए लूप के अन्य स्टेटमेंट्स को skip करना चाहते है.
syntax:- continue;
Fig:-continue flowchart
निवेदन:- अगर आपको यह पोस्ट पसंद आई है तो आप हमें कमेंट के माध्यम से बताइए तथा अपने दोस्तों के साथ इसे share करें.
Thnx
Thnqq so muchh it’s very simple language to read the statements
Very nice sir
Thanks prawin
Thankyou so much…
Hiii
I m kundan
Control system block diagram with all details
Sir ji computer graphics ke notes dale do
Nice sar
Thanks
Welcome neha…
Nice…… bht acha h
nice
Thanks rahul…keep visiting for such useful posts
Thank u so much sir for sharing detail with us
Welcome roja… Glad u like it…
Keep visiting for such useful posts…
Bht Acha h..
Good plzz pointer in details notes
nice sir
nice site
good and thanks alot..
Nice sir thanks to..
Thank you very much sir….
Good sir ji
Thank you
Thank you so much sir bht mast very easy and simple
Ham to dhanney ho gaye
Thanq so muchhhhhh
Wow thanks anjum …aapko mere notes acche lage iske liye dhnywaad…
Keep visiting..
Thans Sar nice topic
Thaks Sar nice topic
Wonderful sir
Thanks for providing knowledge
Case ke baad : break ke baad ; lagate h sir
Thank you sir
sir please call by reference ka ek topic topic upload ka do..
जिसका कंटेंट आसान हो….
please email me…
Thanks sir mujhe es topic me problem thi Jo ab solve ho gayi h
welcome sakshi.. keep visiting
Sorry sir vi network nhi pkada esliye do bar comment ho gya
Bahut achhi notes hai
Really helpful for all students