Hi all, just not long started university and have now started c programming. It is very interesting and im enjoying it so far but have hit a brick wall, and need some help/guidance.
I have got a problem/question to answer and i cant get the right code together to solve it.
The question is to calculate the time in seconds, the time it takes for a capacitor to charge to 35%/75% and 95%. The code must prompt the user to enter values for the resistor and capacitor, in which ive done, but i cant work out how to calculate the time in seconds after calculating the time constant (roughly 63% of the capacitor full charge), the user should only see the values in seconds for the time it takes to charge to 35%,75% and 95%. Please help, here is the code i have currently got together.
Code:
#include <stdio.h>
#include <math.h>
float timeconstant(float R, float C);
float R;
float C;
float time_c;
int main(void)
{
printf("State a Value For The Resistor?\n");
scanf("%f",&R);
printf("State a Value For The Capacitor?\n");
scanf("%f",&C);
time_c = timeconstant(R,C);
printf("Time Constant is : %.2f \n" ,time_c);
getchar();
getchar();
}
float timeconstant(float R1, float C1)
{
float t_constant;
t_constant = R1*C1;
return t_constant;
}