Calculate the discharge by c program, C/C++ Programming

Assignment Help:

#include stdio.h
#include math.h

float discharge(float,float);
void main()
  {
  char prompt;   
  float time,out,cr;
  cr = 100e-6;
  for (time = 0;time<=5*cr;time+=10e-6)
  {
  /* call the function */
  out = discharge(time,cr);
  /*Note g formattor defaults to expontential */
printf("The capacitor voltage at time %10.5g seconds  is %5.3f \n\r ",time,out);
  }    
  printf("Press any key to exit \n\r");
  scanf("\n%c",&prompt);  
  }
 
float discharge(float t,float cr)
{
  float vs,vc;
  /* calculate the discharge */
  vs = 10.0;
  vc = vs*exp(-t/cr);
  return(vc);
}


Related Discussions:- Calculate the discharge by c program

Program, write a program that adds all numbers from 1 to 200

write a program that adds all numbers from 1 to 200

Homework, 5 questions. plus i will provide the "vector.h" for the questions...

5 questions. plus i will provide the "vector.h" for the questions that needs it

How does a structure differ from an array, Question : (a) What is a str...

Question : (a) What is a structure? Provide a simple example of your own to illustrate this feature. (b) How does a structure differ from an array? (c) Describe a structu

Padovan string, write a C program for padovan string for a natural number

write a C program for padovan string for a natural number

I need website product section search box coding section fix, I need websit...

I need website Product section search box coding section fix Project Description: On our products section in the search box it only searches the name and title of our product

Online Tutor Available, I am an online tutor who can teach computer science...

I am an online tutor who can teach computer science and programming language. Is there any requirement for this?

Compass bearing, write a c program that converts compass bearings into dire...

write a c program that converts compass bearings into direction

Data structures, what are 3 conditions under which the sequential search of...

what are 3 conditions under which the sequential search of a list is preferable to binary search?

C programming, write a c program to solve exanple of lamis therom

write a c program to solve exanple of lamis therom

Define advantages of multi file program, Define Advantages of Multi File Pr...

Define Advantages of Multi File Program? The main merits of spreading a program across several files are: • Teams of programmers able to work on programs. Every programmer w

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd