Write Scanf() Program function
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCZNcxUfbLjcpeJf9jlZ26HDzD5XOSApxPuR32UjeWdnO1MBrohjWGZm1jRGmc5Wmm_GFScLEaAq7QrYunPAyaM5vI2aGkpWxDV506utx_SYFYDmj8_0GLy6lGUiSf7E4pS42y9gCXl_Y/w640-h480/Write+Scanf%2528%2529+function.jpg)
Write Scanf() function
चुंकि scanf(
) Function की एक विशेषता ये है की ये Function Blank Space से Terminate हो जाता है |
इसलिए
यदि हम किसी मान को Input करते समय space
या Entery Key द्वारा कई मानों को अलग – अलग
कर दे , तो Input किया गया मान scanf( ) Function में specify किए गए विभन्न variables में store हो जाते है |
उदाहरण
के लिए हम यहां दो संख्याओं को जोड़ने का एक Program बना
रहे है , जिसमें एक ही scanf() function द्वारा दोनों मानों
को Input किया जा रहा है
#include <stdio.h>
#include <conio.h>
main()
{
/* Declaration Section */
int firstVal, secondVal, result;
/* Input Section */
printf("Enter First and Second Values ");
scanf("%d%d", &firstVal, &secondVal);
/* Process Section */
result = firstVal + secondVal;
/* Output Section */
printf("\n Total of %d and %d is = %d ", firstVal, secondVal, result);
getch();
No comments