Write a C program that includes a function called divvy that

Write a C program that includes a function called divvy that accepts two double arguments. When called, the function will return the first argument divided by the second argument. Make sure your function includes a decision statement so that it can\'t divide by 0. Use the numbers 22 and 7 as the arguments, call your function from main() using those arguments, then display the value returned by divvy().

Solution

#include<iostream.h>

#include<conio.h>

void divvy(double, double);

void main()

{

clrscr();

double x, y;

cout<<\"Enter the two number:\";

cin>>x>>y;

divvy(x,y);

getch();

}

void divvy(double a, double b)

{

double z;

z=a/b;

cout<<\"Result= \"<<z;

}

Write a C program that includes a function called divvy that accepts two double arguments. When called, the function will return the first argument divided by t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site