Commit 89ff046618078b3e73b4f14ae9ae96702137bd3a
1 parent
479fbb083f
Exists in
master
p1 done
Showing 4 changed files with 18 additions and 0 deletions Side-by-side Diff
HW3/force.c
View file @
89ff046
1 | +#include <stdio.h> | |
2 | + | |
3 | +int main() { | |
4 | + double q1 = 0.0, | |
5 | + q2 = 0.0, | |
6 | + r = 0.0, | |
7 | + k = 89.8755, | |
8 | + F = 0.0; | |
9 | + printf("Two charges and their distance: "); | |
10 | + scanf("%lf mC, %lf mC, %lf cm", &q1, &q2, &r); | |
11 | + F = k * (q1 * q2) / (r * r); | |
12 | + printf("The electric force is %.4lf N\n", F); | |
13 | + return 0; | |
14 | +} |
HW3/force.out
View file @
89ff046
HW3/force_in.txt
View file @
89ff046
HW3/force_out.txt
View file @
89ff046
1 | +Two charges and their distance: The electric force is 0.7576 N |