top of page

What is an Algorithm, Representation of an Algorithm, Flowchart, Header file in C

  • Writer: Siddharth Sharma
    Siddharth Sharma
  • Sep 2, 2025
  • 3 min read

📘 1. Algorithm (एल्गोरिदम)

Algorithm एक finite और well-defined sequence of steps है जो किसी problem को solve करने या किसी task को perform करने के लिए बनाया जाता है। इसे आप एक recipe की तरह समझ सकते हैं — जैसे खाना बनाने के लिए step-by-step instructions दिए जाते हैं, वैसे ही algorithm किसी computation या problem solving के लिए instructions देता है।

📝 More Characteristics (विशेषताएँ):

1.      Finiteness (सीमितता) → Algorithm का end ज़रूरी है। Infinite loop algorithm नहीं कहलाता।

2.      Definiteness (स्पष्टता) → हर step clear और well-defined होना चाहिए, कोई ambiguity नहीं।

3.      Input (इनपुट) → Algorithm zero या अधिक inputs ले सकता है।

4.      Output (आउटपुट) → कम से कम एक meaningful result generate होना चाहिए।

5.      Effectiveness (प्रभावशीलता) → Steps practical और executable होने चाहिए।

6.      Generality (सामान्यता) → Algorithm किसी single case के लिए नहीं बल्कि एक category की problems solve करने के लिए होना चाहिए।


Example (दो numbers का sum निकालने का algorithm):

1.      Start

2.      Read two numbers A और B

3.      Calculate S = A + B

4.      Print S

5.      Stop

📘 2. Representation of Algorithm (एल्गोरिदम का निरूपण)

Algorithm को represent करने के कई तरीके होते हैं, लेकिन सबसे common हैं:


(a) Pseudo-code Representation (छद्म कोड)

  • यह English-जैसे statements का set होता है।

  • Advantage → Easy to write, easy to understand।

  • Disadvantage → इसे computer execute नहीं कर सकता।

Example (Find Maximum of Two Numbers):

Step 1: Start

Step 2: Input A, B

Step 3: If A > B then

            Print A

        Else

            Print B

Step 4: Stop


(b) Flowchart Representation (प्रवाह-चित्र)

  • Algorithm को symbols और arrows के द्वारा visually represent किया जाता है।

  • Flowchart debugging और visualization में बहुत useful होता है।

  • Symbols standard होते हैं (oval, rectangle, diamond, parallelogram आदि)।

👉 Advantage → Clear communication, easy to understand।👉 Disadvantage → Complex problems में flowchart बहुत बड़ा हो जाता है।

What is algorithm and flow chart in Hindi

📘 3. Flowchart (फ्लोचार्ट)

👉 Detailed Definition

Flowchart एक graphical representation of an algorithm है, जिसमें steps को symbols और उनके sequence को arrows से दिखाया जाता है।


📝 Advantages (लाभ)

1.      Algorithm को visualize करना आसान हो जाता है।

2.      Program को debug और modify करना आसान।

3.      Team members और beginners के लिए समझना आसान।

4.      Complex problems को divide करके represent करना आसान।


📝 Limitations (सीमाएँ)

1.      बहुत बड़े और complex problems में flowchart cumbersome हो जाता है।

2.      बार-बार changes करने पर redraw करना पड़ता है।

3.      Manual drawing time consuming है।

📝 Common Flowchart Symbols:

  • Oval (◯) → Start / End

  • Rectangle (▭) → Process (calculation, assignment)

  • Diamond (◇) → Decision (Yes/No)

  • Parallelogram (⧄) → Input / Output

  • Arrow (→) → Flow of control

Example Flowchart (दो numbers का sum निकालने के लिए):

   [Start]

      |

  [Input A, B]

      |

  [S = A + B]

      |

 [Print S]

      |

   [Stop]


Example: Flowchart for finding the largest of three numbers:


  1. Start

  2. Input A, B, C

  3. Compare A, B, and C using decision diamonds

  4. Output the largest number

  5. End


📘 4. Header File in C (C में हेडर फ़ाइल)

👉 Detailed Definition

Header file एक file होती है जिसमें functions, macros और constants की declarations लिखी होती हैं। जब हम program में #include directive लगाते हैं, तो compiler उन declarations को program में जोड़ लेता है। इससे हमें बार-बार functions define करने की ज़रूरत नहीं होती।


📝 Why Header Files are Important?

1.      Reusability – बार-बार same functions लिखने की ज़रूरत नहीं।

2.      Readability – Program छोटा और readable बनता है।

3.      Standardization – हर programmer same libraries use करता है।

📝 Types of Header Files:

1.      Standard Header Files (Built-in)

o   पहले से बने होते हैं।

o   Examples:

§  <stdio.h> → Input/Output functions (printf, scanf)

§  <conio.h> → Console I/O functions (getch, clrscr)

§  <math.h> → Math functions (sqrt, pow, log)

§  <string.h> → String functions (strlen, strcmp, strcpy)

§  <stdlib.h> → Memory allocation, conversion functions (malloc, free, atoi)

§  <ctype.h> → Character handling (isdigit, isalpha, toupper)


2.      User-Defined Header Files

o   Programmer खुद बना सकता है।

o   Example:

o   #include "myheader.h"

o   इसमें user-defined functions declare किए जा सकते हैं और multiple files में reuse किए जा सकते हैं।

📝 Example Program with Header Files:

#include <stdio.h>   // standard input-output

#include <math.h>    // math functions

 

int main() {

    int num = 25;

    double root = sqrt(num);   // using function from math.h

    printf("Square root = %f", root);

    return 0;

}

✅ Conclusion (निष्कर्ष)

  • Algorithm → किसी problem को solve करने का finite, step-by-step method।

  • Representation of Algorithm → Pseudocode (text form) और Flowchart (graphical form)।

  • Flowchart → Algorithm का diagrammatic representation with standard symbols।

  • Header File in C → Ready-made functions और macros की collection, जिससे programming आसान और efficient होती है।

 

 
 
 

Comments


bottom of page