Free tutorials & notes in Hindi & English · Clean code examples 🧰 मुफ़्त PDF और फ़ोटो टूल्स →
🧩 Unit 2 – Problem Solving  ·  Lesson 10

Flowchart, Pseudocode और Decomposition

Algorithm दिखाने के तरीके

Algorithm आसान steps में लिख सकते हैं (जैसे पिछले lesson में), पर दो standard रूप ज़्यादा साफ़ हैं: flowchart (picture) और pseudocode (structured English)।

Flowchart

  • Standard shapes और arrows वाला diagram
  • Flow एक नज़र में दिखता है
  • छोटे algorithms के लिए अच्छा
  • बड़े programs में बदलना मुश्किल

Pseudocode

  • IF, WHILE, PRINT जैसे keywords वाला text
  • असली code के करीब
  • बदलना आसान
  • कोई standard picture नहीं
एक ही algorithm दिखाने के दो तरीके

Flowchart symbols

Symbolनामकिसलिए
⬭ Oval (गोल किनारे)TerminatorStart / Stop
▱ ParallelogramInput / OutputInput लेना, output print करना
▭ RectangleProcessCalculation या assignment, जैसे sum = a + b
◇ DiamondDecisionYes/No प्रश्न, दो रास्ते
→ ArrowFlow lineSteps का क्रम दिखाता है
○ छोटा गोलाConnectorलंबे flowchart के हिस्से जोड़ता है

Flowchart: sequence

Steps एक के बाद एक, ऊपर से नीचे चलते हैं। Example: simple interest SI = P × R × T ÷ 100।

StartInput P, R, TSI = P × R × T / 100Print SIStop
Sequence – simple interest

Flowchart: selection (if-else)

Diamond दो में से एक रास्ता चुनता है। Example: marks ≥ 33 हो तो "Pass", नहीं तो "Fail"।

StartInput marksmarks >= 33 ?YesNoPrint "Fail"Print "Pass"Stop
Selection – pass या fail

Flowchart: repetition (loop)

Arrow पिछले step पर वापस जाता है ताकि condition true रहने तक steps दोहराए जाएँ। Example: 1 से N तक के numbers का जोड़।

StartInput Ntotal = 0, i = 1i <= N ?YesNoPrint totaltotal = total + ii = i + 1Stop
Repetition – loop वापस decision पर जाता है
Python
n = int(input('Enter N: '))
total = 0
i = 1
while i <= n:
    total = total + i
    i = i + 1
print('Sum =', total)
Enter N: 5 Sum = 15

Pseudocode

Pseudocode ("नकली code") algorithm को capital letters के simple keywords — INPUT, COMPUTE, PRINT, IF … THEN … ELSE, WHILE, FOR — और blocks दिखाने के लिए indentation से लिखता है।

Pseudocode
INPUT marks
IF marks >= 90 THEN
    PRINT "Grade A"
ELSE IF marks >= 60 THEN
    PRINT "Grade B"
ELSE
    PRINT "Grade C"
END IF
Pseudocode
INPUT N
SET fact = 1
FOR i = 1 TO N
    fact = fact * i
END FOR
PRINT fact
💡 Tips

हर line में एक action लिखें, IF और loops की body indent करें, और Python के colon या brackets की चिंता न करें। कोई भी इसे पढ़ सके।

Flow of control

Steps जिस क्रम में चलते हैं उसे flow of control कहते हैं। हर algorithm सिर्फ़ तीन building blocks से बनता है:

⬇️
SequenceSteps एक के बाद एक। Example: input → calculate → print।
🔀
SelectionCondition के आधार पर रास्ता चुनना। Example: age ≥ 18 तो vote।
🔁
Repetition (iteration)Condition रहने तक steps दोहराना। Example: 1 से 10 print।
Control flow के तीन प्रकार

Decomposition

Decomposition यानी बड़ी problem को छोटे हिस्सों में तोड़ना। हर हिस्सा अलग से solve होता है (अक्सर अलग team member से) और फिर हिस्से जोड़े जाते हैं। School result system ऐसे decompose हो सकता है:

📁 result-system/
├── read_marks          # हर student के marks input
├── total_and_percent   # calculations
├── grade               # A1, A2, B1 ...
├── rank                # students sort
└── print_report_card   # output
Result system को sub-problems में तोड़ना

Python में हर sub-problem एक function बनता है:

Python
# Decomposition: one big task split into small functions
def read_marks():
    return [78, 85, 92, 66, 81]          # sample marks

def total_of(marks):
    return sum(marks)

def grade_of(percent):
    if percent >= 90: return 'A1'
    if percent >= 80: return 'A2'
    if percent >= 70: return 'B1'
    return 'B2'

marks = read_marks()
t = total_of(marks)
p = t / len(marks)
print('Total:', t, '| Percent:', p, '| Grade:', grade_of(p))
Total: 402 | Percent: 80.4 | Grade: A2

सारांश और practice

  • Flowchart symbols: oval (start/stop), parallelogram (I/O), rectangle (process), diamond (decision), arrows (flow)।
  • Pseudocode INPUT, IF, WHILE, PRINT जैसे keywords और indentation use करता है।
  • Flow of control: sequence, selection, repetition।
  • Decomposition बड़ी problem को छोटी problems में बाँटता है।
✅ Practice

Flowchart बनाएँ और pseudocode लिखें: (1) किसी number का पहाड़ा print करना, (2) number positive, negative या zero है।

Hint: (1) में 1 से 10 तक loop; (2) में दो decisions: N > 0, फिर N < 0।

अक्सर पूछे जाने वाले प्रश्न (FAQ)

Decision के लिए कौन सा flowchart symbol है?
Diamond। इसमें "marks >= 33?" जैसा yes/no प्रश्न होता है और Yes और No नाम के दो रास्ते निकलते हैं।
Pseudocode और program में क्या फ़र्क है?
Pseudocode आसान English जैसे statements में लिखा जाता है और किसी language के सख़्त rules follow नहीं करता, इसलिए चल नहीं सकता। Program Python जैसी language का exact syntax follow करता है और चलाया जा सकता है।
Decomposition क्या है?
बड़ी, complex problem को छोटी sub-problems में तोड़ना जो अलग-अलग समझना और solve करना आसान हो, फिर उनके solutions जोड़ना।
← Class 11 Computer Science
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

अगला topicPython की शुरुआत आपकी प्रगति: 10 / 29 (34%) · Lesson 11 / 29 आगे बढ़ें →

यह lesson कैसा लगा?

आपकी राय से हम content और बेहतर बनाते हैं।

अपना review और सुझाव लिखें (वैकल्पिक)

Review approve होने के बाद आपका नाम और शहर इसके साथ public दिख सकते हैं। Email या phone न लिखें।

▶ CodingEasily on YouTube

Video से सीखें – आसान Hindi में

चुनी हुई video: RDBMS भाग 3 – Class XI Commerce IT

▶ Channel subscribe करें