Saturday, May 12, 2012

Expression Evaluation: Electrical Force

Hello Friends!!! hope, you all are well by the grace of Almighty. Today we learn how to find out the electrical force. Let's look at the problem.

Problem:  Calculate the electrical force F between charges q1 and q2 separated by a distance r meters using Coulombs Law as given below. Charge quantities q1 and q2 are input data in this problem and force F is the output quantity. The value of  Epsilon naught is 8.85E-12 F/m is a constant quantity and ignore units.


F = (q1 x q2)/ (4 x pi x epsilon naught x r x r).


Solve:
































In this program #define is used. We define the value of pi after the header file. #define is used by following way:

#define constant_name constant_value


"E" is used for "10^". If we want to see result in "E" format, we have to use "%E". In this program it is used.

Thank you all..:)

0 comments:

Post a Comment