Question

Write a C program that finds voltage drop and power dissipated by a resistance (R) when...

Write a C program that finds voltage drop and power dissipated by a resistance (R) when a current (I) flows through it. Resistance and current values are given as inputs. Create a function that would find the voltage drop, and create another function that would find the power. Use these functions in your program and print the voltage drop and power dissipated on the console. The input and output values are single precision floating-point values. Comment your code.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <stdio.h>
#include <math.h>

double voltageDrop(float p, float r)
{ double v;
v=p*r;
v=sqrt(v);
return v;
}
double power(float v, float r)
{ double p;
p=(v*v)/r;
return p;
}

int main()
{
printf("Please enter the input for valtage drop \n");
float P,R,V;
double Vd,Pd;
printf("\n Enter the Registance field value: ");
scanf("%f", &R);
printf("\n Enter the Power field value: ");
scanf("%f",&P);
// find voltage drop

Vd=voltageDrop(P,R);
printf("print the voltage drop %lf", Vd);

// find Power

printf("\n*********For Power measure********\n ");
printf("please enter valtage drop: ");
scanf("%f", &V);


Pd=power(V,R);
printf("\n print powe %lf", Pd);

}

Add a comment
Know the answer?
Add Answer to:
Write a C program that finds voltage drop and power dissipated by a resistance (R) when...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The power dissipated by a resistor with a resistance of R = 260 Ω is P...

    The power dissipated by a resistor with a resistance of R = 260 Ω is P = 2.3 w. what are the current through (in A) and the voltage drop (in V) across the resistor? current.088 voltage 22.8 X A

  • 9) The power p dissipated in a resistor of resistance R when a current i flows...

    9) The power p dissipated in a resistor of resistance R when a current i flows throw it is given by priʻR (see Lab-1). Write a C++ program that reads the resistance R (in ohms) and then outputs p for all i values between 0 and 5, inclusive, in intervals of 0.5 Amps. Use a for loop.

  • Write a program that calculates voltage from current and resistance values. Create three one-dimensional arrays named...

    Write a program that calculates voltage from current and resistance values. Create three one-dimensional arrays named current, resistance and voltage, each capable of holding 10 double-precision values. The values stored in current and resistance are as follows: current = 10.62, 14.89, 13.21, 16.55, 18.62, 9.47, 6.58, 18.32, 12.15, 3.98 resistance = 4.0, 8.5, 6.0, 7.35, 9.0, 15.3, 3.0, 5.4, 2.9, 4.8 Have your program pass these three arrays to a function called calcVolts() which calculates the elements in the voltage...

  • c++ no pointers just follow instructions Write a program (array.cpp) that read positive floating point numbers...

    c++ no pointers just follow instructions Write a program (array.cpp) that read positive floating point numbers into an array of capacity 100. The program will then ask for one of three letters(A, M or S). if the user inputs something other than one of these letters, then the program should ask for that input until an A, M, or S is entered. A do-while loop should be used for this. If the user inputs an A, then the program should...

  • MIPS CODE required to write an assembly program to find the maximum of an array of integers by...

    required to write an assembly program to find the maximum of anarray of integers by doing the following:1. Prompt user to input array size n (n <= 10)2. Prompt user to input element values of array A one by one3. Display the result on the console.This program must at least include one function. The main program will read the valuesof the array (as user inputs the element values) and stores them in the memory (datasegments section) and at the end...

  • Problem: Design and write a C language program that can be used to calculate Voltage, Current...

    Problem: Design and write a C language program that can be used to calculate Voltage, Current and Total Resistance for a Series or Parallel or a Series Parallel circuit. The program should display the main menu that contains the three types of circuit calculations that are available and then the user will be prompted to select a circuit first. After the circuit has been selected the program should then display another menu (i.e., a submenu) requesting the necessary data for...

  • Create a CPP file for a C++ Program. Write exactly these functions, power(x,y) function and a...

    Create a CPP file for a C++ Program. Write exactly these functions, power(x,y) function and a print(text, number) function and the main() function. The power(x,y) function returns an integer result that is calculated by raising a number x (integer) to a power y (integer). The second argument y (exponent) of the function can not exceed 100. If the second argument exceeds 100, the function should return -1. Your power(x,y) function must be able to take either 1 or 2 integer...

  • WRITE A PROGRAM IN C THAT DOES THE FOLLOWING Read a floating point number without using...

    WRITE A PROGRAM IN C THAT DOES THE FOLLOWING Read a floating point number without using scanf or conversion functions from the C library. You would need to write a utility function that processes console input using only getc and/or getchar and flow of control logic to process character-based input from the console to process the input.

  • Q1. (3 marks) In the circuit shown below, R-1.5KO and the voltage drop across Ri is...

    Q1. (3 marks) In the circuit shown below, R-1.5KO and the voltage drop across Ri is 4.5V. (1 pt.) A. What is the voltage drop across R? (1 pt.) B. What is the value of the resistance R? (1 pt.) C. What is the power delivered by the source voltage? S Answer: wwiw R Ri Vs=15V Q2. (3 marks) Refer to the circuit below. A. Using the voltage divider law, find the voltage between the points A and B. B....

  • Write a program in C++. You need everything everythihng given You will create a function that...

    Write a program in C++. You need everything everythihng given You will create a function that validates input. It should accept only non-negative integers. If the input is incorrect the function should throw an exception. The exception will not be caught in the function. You will create a function that reads in 2 integer values. One is a number that will be raised to the power of the second. So if 5 and 6 are entered the result would be...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT