Answer to Question #330903 in C for Habib

Question #330903

Implement the following problem in C programming language with following functions:


1- A function “Speed” that takes meters and seconds as parameters and returns the speed in meter


per second (m/s).


2- A function “Convert” that returns the kilometer per hour (kph) equivalent of m/s.


Call the above created function in main to test them.

1
Expert's answer
2022-04-19T10:01:17-0400



#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>


//Implement function Speed
double Speed(unsigned metr,unsigned sec)
{
  //Take two argument
  //@metr-Metr
  //@sec-Second
  return (metr*1.0)/(sec*1.0);
}
//Convert  m/s to km/h 
double Convert(double ms)
{
  return ms*3.6;
}
int main(void) {
  unsigned metr;
  unsigned second;
  
  printf("Please enter metr:");
  scanf("%u",&metr);
  
  printf("Please enter second:");
  scanf("%u",&second);


  double ms=Speed(metr,second);
  printf("%lf m/s\n",ms);
  double km=Convert(ms);
  printf("%lf km/h\n",km);
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS