Question

I must call multiply, divide and remainder functions inside of SUBTRACT function.. I am stuck at...

I must call multiply, divide and remainder functions inside of SUBTRACT function.. I am stuck at this point. Thank you

#include<stdio.h>

int getDifference(int a, int b);
int main()
{
int a, b, result, multiply, divide, rem;

printf("Enter the two integer numbers : ");
scanf("%d %d", &a, &b);

//Call Function With Two Parameters

result = getDifference(a, b);
  

printf("Difference of two numbers is : %d\n" , result);
  
return (0);
}

int getDifference(int a, int b)
{
int c, multiply;
float rem, divide;

c = a - b;
return (c);


float rem ( int a, int b);
float divide( int a, int b);
int multiply (int a, int b);
  
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Dear Student,

below i written the C code as per the requirement.

Please note the below program has been tested on ubuntu 16.04 system and compiled using C compiler. This code will also work on other iDe;'

-----------------------------------------------------------------------------------------------------------------------------------

Program:

-----------------------------------------------------------------------------------------------------------------------------------

#include<stdio.h>

int getDifference(int a, int b);

float rem ( int a, int b);

float divide( int a, int b);

int multiply (int a, int b);

int main()
{

   int a, b, result, multiply, divide, rem;

   printf("Enter the two integer numbers : ");

   scanf("%d %d", &a, &b);

   //Call Function With Two Parameters

   result = getDifference(a, b);

   printf("Difference of two numbers is : %d\n" , result);

   return (0);
}

int getDifference(int a, int b)
{
   int c, mul;

   float r, d;

   c = a - b;

rem(a, b);

divide(a, b);

multiply(a, b);

mul = multiply(a, b);

   d = divide(a, b);

   r = rem(a, b);

   printf("The rem of two numbers is: %lf\n", r);

   printf("The divide of two numbers is: %lf\n", d);

   printf("The multiply of two numbers is: %d\n", mul);

return c;

}

//function defintions

float rem ( int a, int b)

{

return a%b;

}

float divide( int a, int b)

{

return a/b;

}


int multiply (int a, int b)

{

return a*b;

}


===============================================================

Output:

================================================================

Kindly Check and Verify Thanks...!!!

Add a comment
Know the answer?
Add Answer to:
I must call multiply, divide and remainder functions inside of SUBTRACT function.. I am stuck at...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write the functions to add, subtract, multiply and divide two doubles. The function returns the result...

    Write the functions to add, subtract, multiply and divide two doubles. The function returns the result on the operation. Write a program to test your functions. In visual studios console application C#.

  • Using the code snippet below, complete the missing sections using the comments as a guide ********************************************************************************...

    Using the code snippet below, complete the missing sections using the comments as a guide ******************************************************************************** #include <stdio.h> #include <stdlib.h> // The four arithmetic operations ... one of these functions is selected // at runtime with a switch or a function pointer float Plus (float a, float b) { return a+b; } float Minus (float a, float b) { return a-b; } float Multiply(float a, float b) { return a*b; } float Divide (float a, float b) { return a/b;...

  • Given an array of integer, please complete a function multiply(). The function accepts the first memory...

    Given an array of integer, please complete a function multiply(). The function accepts the first memory address of an array and the size of an array as parameters and returns the multiplication of all the elements. In order to get a full score, the function must use a loop to iterate through each element of an array. Pseudo code example:   multiply([ 1, 2, 3], 3) → 6   multiply([1, 1, 4 ,2], 4) → 8   multiply([7, 0, 0, 7, 0, 7],...

  • I am trying to change my code so i no longer need the function that reads...

    I am trying to change my code so i no longer need the function that reads in the users base and height input but rather uses the implementation of argument vector in C. I want to accept command line arguments and have it calculate my area. so i want to type this into the command line and have it calculate my area project1 5 4 #include <stdio.h> void userDimensions(float *base, float *height) { scanf("%f", base); scanf("%f", height); } float calcArea(float...

  • I am trying to create a function that increments x 4 times, then my program prints...

    I am trying to create a function that increments x 4 times, then my program prints the results. For some reason my function is not changing the value of x. It just stays the same. #include <stdio.h> int Incrementx4Times(int x) // This function increments user inputted value { int count;   //increments 4 different ways   x++; x=x + 1; ++x; x += 1; return x; } void main(void) { int x; printf("x? "); scanf("%d", &x); printf("x = %d\n", x); Incrementx4Times(x); //Call...

  • I need the programming to be in language C. I am using a program called Zybook...

    I need the programming to be in language C. I am using a program called Zybook Prompt: Write a statement that outputs variable numObjects. End with a newline. Given: #include <stdio.h> int main(void) { int numObjects; scanf("%d", &numObjects); return 0; } What I did so far. I am not sure if its right tho? #include <stdio.h> int main(void) { int numObjects; scanf("%d", &numObjects); printf(" num Objects is "); printf("%d\n", userAge); return 0; }

  • /* •   The following code consists of 5 parts. •   Find the errors for each part...

    /* •   The following code consists of 5 parts. •   Find the errors for each part and fix them. •   Explain the errors using comments on top of each part. */ #include <stdio.h> #include <string.h> int main( ) { ////////////////////////////////////////////////////////////////////////// //////////////        Part A. (5 points)                ////////////////// int g(void) { printf("%s", Inside function g\ n " ); int h(void) {       printf(" % s ", Inside function h\ n "); } } printf("Part A: \n "); g(); printf(" \n"); ////////////////////////////////////////////////////////////////////////// //////////////       ...

  • Define four static methods, named add, subtract, multiply, and divide. Each of these methods should be...

    Define four static methods, named add, subtract, multiply, and divide. Each of these methods should be defined to take two Fraction arguments and return a new Fraction. For now, though, each of these methods should return null. Define a constructor that takes two int parameters, corresponding to the numerator and denominator of a fraction. For now, the constructor should do nothing with these parameters; the constructor body should be empty. You may think this odd, but the reasons will be...

  • SEE THE Q3 for actual question, The first Two are Q1 and Q2 answers . Q1...

    SEE THE Q3 for actual question, The first Two are Q1 and Q2 answers . Q1 #include<iostream> using namespace std; // add function that add two numbers void add(){    int num1,num2;    cout << "Enter two numbers "<< endl;    cout << "First :";    cin >> num1;    cout << "Second :";    cin >>num2;    int result=num1+num2;    cout << "The sum of " << num1 << " and "<< num2 <<" is = "<< result;   ...

  • 1. Write code for a function that receives two parameters (a,and b) by value and two...

    1. Write code for a function that receives two parameters (a,and b) by value and two more parameters (c and d) by reference. All parameters are double. The function works by assigning c to (a/b) and assigning d to (a*b). The function has no return value. From main, use scanf to get two numbers, then call the function, and then display both outcome values to the output in a printf statement. 2. After part 1 is completed, write code to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT