Control Structure, Sequential Structure, Selection Structure, Iterative Structure

Control Structure

A statement that is used to control the flow of execution in a program is called control structure.
It combines instruction into logical unit.
एक स्टेटमेंट जिसका प्रयोग प्रोग्राम के एक्सीक्यूशन के प्रवाह को नियंत्रित करने के लिए किया जाता है, कंट्रोल स्ट्रक्चर कहलाता है। यह लॉजिकल यूनिट एवं इंस्ट्रक्शन को जोड़ने का कार्य करता है । 

Types of control structures -
1.     Sequential Structure
2.     Selection Structure
3.     Iterative Structure

कंट्रोल स्ट्रक्चर के प्रकार -
1. सीकवेंशियल स्ट्रक्चर
2. सिलेक्शन स्ट्रक्चर
3. इटरेटिव स्ट्रक्चर

1.  Sequential structure:
Statements are executed in a specified order. No statement is skipped and each statement is executed once in a program. example - simple interest program.

1. सीकवेंशियल स्ट्रक्चर:
स्टेटमेंट को एक के बाद एक क्रम से एक्सीक्यूट किया जाता है , किसी भी स्टेटमेंट को छोड़ा नहीं जाता है, प्रत्येक स्टेटमेंट प्रोग्राम में केवल एक बार एक्सीक्यूट होता है। उदाहरण साधारण ब्याज का प्रोग्राम। 


2. Selection Structure:
It selects a statement to execute on the basis of condition. Statement is executed when the condition is true and skipped when it is false like if block, if else block, conditional operator, switch case programs. for example even odd number program.

2. सिलेक्शन स्ट्रक्चर:
यह स्ट्रक्चर कंडीशन के आधार पर स्टेटमेंट का चयन कर उन्हें एक्सीक्यूट करता है यदि कंडीशन ट्रू है तब स्टेटमेंट को एक्सीक्यूट किया जाता है यदि नहीं तब उसे छोड़ दिया जाता है इस हेतु if block, if else block, conditional operator, switch case का प्रयोग किया जाता है। 











3. Iterative Structure:
the statements are executed multiple times until condition is false. It is also known as repetitive or loop structure like while loop, for loop, do-while loop programs. example- counting from 1 to 100 , table of N program.

3. इटरेटिव स्ट्रक्चर:
स्टेटमेंटस को कई बार एक्सीक्यूट किया जाता है जब तक की कंडीशन फाल्स ना हो जावे। इसे रिपीटीटीव या लूप स्ट्रक्चर के नाम से भी जाना जाता है। इस हेतु while loop, for loop, do-while loop का प्रयोग किया जाता है। उदाहरण 1 से 100 तक गिनती , N का पहाड़ा ज्ञात करने का प्रोग्राम  





No comments:

Post a Comment