Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part 1 Write a C program that reads two integer numbers from the input and calls

ID: 3537381 • Letter: P

Question

Part 1 Write a C program that reads two integer numbers from the input and calls a MyMult. MyMult does the multiplication of the two numbers and provides the result to the main. The prototype for MyMult is provided below: int MyMult(int, int); Note: DO NOT use the multiplication operator (*) for the multiplication in the function MyMult instead use a different method for performing the multiplication..
Part 2 Rewrite the program in Part 1, but this time use call by reference. main() passes the two integer numbers using a call by value and the MyMult passes the result using a call by reference. The prototype for MyMult is provided below: void MyMult(int, int, int *); In addition, the main() repeats reading from the keyboard until EOF occurs Part 1 Write a C program that reads two integer numbers from the input and calls a MyMult. MyMult does the multiplication of the two numbers and provides the result to the main. The prototype for MyMult is provided below: int MyMult(int, int); Note: DO NOT use the multiplication operator (*) for the multiplication in the function MyMult instead use a different method for performing the multiplication..
Part 2 Rewrite the program in Part 1, but this time use call by reference. main() passes the two integer numbers using a call by value and the MyMult passes the result using a call by reference. The prototype for MyMult is provided below: void MyMult(int, int, int *); In addition, the main() repeats reading from the keyboard until EOF occurs Write a C program that reads two integer numbers from the input and calls a MyMult. MyMult does the multiplication of the two numbers and provides the result to the main. The prototype for MyMult is provided below: int MyMult(int, int); Note: DO NOT use the multiplication operator (*) for the multiplication in the function MyMult instead use a different method for performing the multiplication..
Part 2 Rewrite the program in Part 1, but this time use call by reference. main() passes the two integer numbers using a call by value and the MyMult passes the result using a call by reference. The prototype for MyMult is provided below: void MyMult(int, int, int *); In addition, the main() repeats reading from the keyboard until EOF occurs Rewrite the program in Part 1, but this time use call by reference. main() passes the two integer numbers using a call by value and the MyMult passes the result using a call by reference. The prototype for MyMult is provided below: void MyMult(int, int, int *); In addition, the main() repeats reading from the keyboard until EOF occurs

Explanation / Answer

//PART 2

#include <stdio.h>

void MyMult(int a,int b,int *res)

{

int i=0;

*res=0;

for(i=0;i<a;i++) { *res = *res + b;}

  

}


int main(void) {

printf("Enter 2 numbers ");

int x,y,z;

while(scanf("%d %d",&x,&y))

{

MyMult(x,y,&z);

printf("Output of multiplying %d and %d is %d ",x,y,z);

printf("Enter 2 numbers ");

}

return 0;

}