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 to ask date & days added to produce -c++ program, THIS PROGRAM IS T...

THIS PROGRAM IS TO ASK A DATE & ALSO ASK FOR DAYS TO BE ADDED TO PRODUCE #include #include struct date  {   int dd;   int yy;   int mm;  }; void main()  {  clrscr();  in

Verification class, I need help to understand and do this assignment ******...

I need help to understand and do this assignment ********************************************************* You are to insert the missing code in the C program given for combinatio

Explain the switch construct, The Switch Construct The switch statement...

The Switch Construct The switch statement is a multi-way decision-making construct that tests an expression matches one of a number of constant values, and branches accordingly

Explain passing and returning objects, Passing and Returning Objects Ob...

Passing and Returning Objects Objects can be passed to a function and returned back just like normal variables. When an object is passed by content, the compiler makes another

Explain type casting, Type Casting Implicit type conversions, as allowe...

Type Casting Implicit type conversions, as allowed by the language, can lead to errors creeping in the program if care is not taken. Thus, explicit type conversions may be used

Charity Ball Organizer, Charity Ball Organizer Many charities support g...

Charity Ball Organizer Many charities support good causes, but one of the difficulties each of them has is organizing their fundraising events. After nearly a semester of C pro

CarDealership, ABC Car Dealership needs your help to update the ordering sy...

ABC Car Dealership needs your help to update the ordering system. This car dealer is selling four types of vehicles: Sedan, Truck, SUV, and mini Van. And each type of vehicle can h

Euclidean Algorithm , how can I find the GCD of 2 given numbers using Eucli...

how can I find the GCD of 2 given numbers using Euclidean Algorithm ?

#rotation, #write code for rotation in c

#write code for rotation in c

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