have created a code for solving time capacitor takes to charge up at certain percentages but have run into difficulties.
1.answers i get for time seem to be off ( have worked out examples on paper mathemtically to test this ) wondering if anyone can see where ive gone wrong!
2. for extra marks would like to make use of functions in my code any help would be greatly appreciated. ( as far as i can tell there is only need for one function with three variables in but ive been wrong before)
#include <math.h>#include <stdio.h>
float r;//declaration of resistance variable
float c;//declaration of capacitor varablle
float pv;//declaration of percentage variable as a raio of 100%=1.0
float t;// declaration of the time variable
printf("please enter the value of the resistor in the circuit\n");
printf("please now input the value of the capacitor in the circuit\n");
printf("please now enter the percentage value you would like to investigate as a ratio of 0-1 ( 100%=1.0 )\n");
printf(" the amount of time passed for this given percentage is %f",t);