Header Ads

ad728
  • New Updates

    Write Scanf() Program function


    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

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728