0% found this document useful (0 votes)
26 views

Programming Qs

1) The program reads coordinates (x,y) of a point, calculates the distance from origin, angle in degrees, and quadrant. 2) The program reads voltage and current values, calculates impedance, phase angle in degrees, and power factor. 3) The program reads three voltage values, calculates impedance angle or prints an error message if voltages are impossible.

Uploaded by

Ahmed Jamal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Programming Qs

1) The program reads coordinates (x,y) of a point, calculates the distance from origin, angle in degrees, and quadrant. 2) The program reads voltage and current values, calculates impedance, phase angle in degrees, and power factor. 3) The program reads three voltage values, calculates impedance angle or prints an error message if voltages are impossible.

Uploaded by

Ahmed Jamal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

1-) Write a C program that reads two real numbers (x)and (y) represent the coordinates of a point on a

plane. The program calculates and prints (i) the distance from the origin, (d) (ii) the angle of the vector
connecting the this point to the origin in degrees (angle) and (iii) and the quadrant in which this point is
located. Use the functions provided in math library.

+y

Y-axis
x
(x,y)
Quadrant Quadrant
2 1

y
d
an
gle
X-axis
-x +x
Quadrant Quadrant
3 4
-y

2-) Write a C program that read the amplitude of the voltage VR0, the amplitude and angle of
VXLtheta and the current I0. Determine and print the circuit impedance Z, phase angle (phi) and
the power factor. Enter and print all angles in degrees
VXL

XL
ZÐ phi
I
VR

3-) Write a C program that read the amplitudes of three voltages VR, VZ and VT and determine the
circuit impedance angle, phi. The program should print the appropriate message if the input voltages are
impossible for this case (e.g. VR+VZ>VT). Use the functions provided in C math library as you need.
VZ

Z
ZTÐ phi
VR

VT

4-) Consider the following function:


F=A cos(ωt +φ)
It is desirable to form a 2-dimensional matrix (C) consists of 360 rows and 2 columns. The elements of
nth row are defined as follows:
First column: C[n][0]= tn: where tn=n.
Second column: C[n][1]= F(tn)
Write a C program that reads the function parameters (A,  and ), and determines C. Print the values
of tn and F(tn) at n= 0, 90, 180 and 270.

You might also like