Part 1 Write a function definition called GetTwoDubs that ta
Part 1. Write a function definition called GetTwoDubs that takes two pointer arguments to double values. The function will prompt the user to enter two double values and store them in the two pointer arguments. The function returns nothing.
Part 2. Write a function definition for a function called GetNum that has a double return type and takes no arguments. The function will prompt, get, and return a double.
Part 3. Write a main function with function calls to GetTwoDubs and GetNum , declare any variables and assign values as needed.
Solution
#include <stdio.h>
void GetTwoDubs(double *a ,double *b) //function with pointers
{
double x,y;
printf(\"\ Enter two double values:\");
scanf(\"%lf %lf \",&x,&y);
*a=x;
*b=y;
}
double GetNum() //function returning double value
{
double num;
printf(\"\ Enter a double value:\");
scanf(\"%lf\",&num);
return num;
}
int main(void)
{
double num1,num2;
GetTwoDubs(&num1,&num2);
printf(\"\ The two double values are :%lf %lf\",num1,num2);
num1=GetNum();
printf(\"\ double value:%lf\",num1);
return 0;
}
output:
Success time: 0 memory: 2164 signal:0
