Saturday, March 15.

Header Ads

Colorful+Black+Friday+Discount+Leaderboard+Ad

Output Function

Muscle+Inc.+%25282%2529

Output+Function

Output Function

‘C’ Language में जब हम किसी परिणाम को Computer की Screen यानी Output Device पर Display करना चाहते है , तब हमें ‘stdio.h’ नाम की Header File में Define किए Printf( ) Function को use करना होता है |

printf( ) Function

‘सी’ भाषा में सभी I/O Functions ‘ Stdio.h’ नाम की Header File में होते है | जब हमें कोई Message या किसी Variable में Stored मान को Screen पर Display करना होता है , तो हम Printf( ) Function का प्रोयोग करते है | इसका Syntax निम्नानुसार है |

printf(“Mesaage ctrlstr1 ctrlstr2 ctrlstrN, variable1, variable2, variable);

मानलो की हम एक ऐसा Program बनाना चाहते है , जिसे Run करने पर Monitor पर एक String Display हो | चूँकि हम हमारे इस Program में किसी प्रकार का कोई भी Input Program में केवल Output Section ही होगा | यदि हुम इस Program का Algorithm बनाना चाहे , तो ये Algorithm निम्नानुसर  बनेगा |

 

Algorithm

1. START                               [Algorithm Starts here.]

2. PRINT “SHADAB ALAM”   [Print the message.]

3. END                                  [Algorithm Ends here.]

यदि इस Algorithm के आधार पर हम यदि “C” Language में Program को Source Code निम्नानुसार होगा :

 

 /* printing only one statement on the screen */
 #include<stdio.h>        /*to Get the Input and output sevices*/
 main( )                 /*main function form where compiler executes program */
 {                       /*Starting of main function */
 printf(“SHADAB ALAM”);  /* Printfs the Message */
 }                       /* Ends the Program */

इस Program को Run करने पर हमें निम्नानुसार Output प्राप्त होता है |

Output

SHADAB ALAM

 

 /*printing only one statement on the screen */
 #include<stdio.h>       /*to Get the Input and output sevices*/
 main( )                 /*main function form where compiler executes program */
 {                       /*Starting of main function */
 printf(“SHADAB ALAM”);  /* Printfs the Message */
 }                       /* Ends the Program */

Program Flow

जब इस Program को Run किया जाता है , तब

1. यदि Program में किसी तरह की कोई Typing Mistake ना हो तो “C” का Compiler सबसे पहले main( ) Function को खोजता है |

2. main ( ) Function के मिल जाने के बाद Compiler main( ) Function के Statement Block में प्रवेश करता है और सबसे पहले clrscr ( ) Function को Execute करता है | ये Statement Output Screen को Clear कर देता है |

3. फिर Program का अगला Statement printf( ) Function Execute होता है | जो Screen पर “SHADAB ALAM” Message को Display करता है |

4. अंत में तीसरा Function getch( ) Execute होता है | ये Function User से एक key Press करने का इंतज़ार करता है और जब तक User Key Press नहीं करता है , तब तक वह Output को Screen पर देख सकता है | जैसे ही User keyboard से किसी key को Press करता है , Program Terminate हो जाता है |   

 

 




No comments

Post Top Ad

Post Bottom Ad