https://www.rakeshmgs.in/search/label/Template
https://www.rakeshmgs.in
RakeshMgs

Programming C me Input Output Kaise kaam karta hai | How can Use printf() and scanf()

Updated:

 C Input and Output

Input का अर्थ program में उपयोग किए जाने वाले कुछ data के साथ input देना है और Output का मतलब स्क्रीन पर data show करना या data को printer या file में लिखना है। ये सभी built-in functions C header files में मौजूद हैं|

scanf() and printf() functions

Standard Input-Output header files, जिसका नाम <stdio.h> है, में function printf() और scanf() की Definition शामिल है, जिनका उपयोग स्क्रीन पर Output प्रदर्शित करने और User से Input लेने के लिए किया जाता है।

	
	
#include<stdio.h> #include<conio.h> void main() { // defining a variable int i; /* displaying message on the screen asking the user to input a value */ printf("Please enter a value..."); /* reading the value entered by the user */ scanf( "%d", &i); /* displaying the number as output */ printf( "\nYou entered: %d", i); }

जब आप उपरोक्त कोड compile करेंगे, तो यह आपको एक value type करने के लिए कहेगा। जब आप value type करेंगे, तो यह compiler पर आपके द्वारा type किए गए value को प्रदर्शित (show) करेगा।

Format String

हम number of digits or characters की संख्या को भी सीमित कर सकते हैं जो input या output हो सकते हैं, " %1d" या "%3s" जैसे प्रारूप string specifier के साथ एक संख्या जोड़कर, पहला a single numeric digit और दूसरा एक का अर्थ है 3 characters का मतलब है, इसलिए यदि आप 42 इनपुट करने की कोशिश करते हैं, जबकि scanf() में "% 1d" है, तो इसे इनपुट के रूप में केवल 4 लगेगा। वही आउटपुट के लिए मामला है।


आपको आर्टिकल कैसा लगा? अपनी राय अवश्य दें
Please don't Add spam links,
if you want backlinks from my blog contact me on rakeshmgs.in@gmail.com