Ask Question

What stdio. h input function would be used to get input from the user by the keyboard? Write the code to obtain the voltage drop across a resister from the user. Assume the input variable is called vr1. What stdio. h output function would be used to provide output to the monitor?

+1
Answers (1)
  1. 2 March, 14:55
    0
    scanf () function is used to get a input from keyboard. This function is in the stdio. h library. To use this function we must include the stdio. h library first in the code. Then only we can use the scanf () function in any code. printf () function is used to print anything. this function is from stdio. h library.

    Code to read voltage drop across the register.

    #include

    / / main function

    int main (void) {

    / / variable

    double vr1;

    printf ("Enter voltage drop:");

    / / read voltage drop from user

    scanf ("%lf",&vr1);

    / / print voltage drop

    printf ("voltage drop is:%0.2lf", vr1);

    return 0;

    }

    Output:

    Enter voltage drop:200.4

    voltage drop is:200.40
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “What stdio. h input function would be used to get input from the user by the keyboard? Write the code to obtain the voltage drop across a ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers