Reply 1

profileAdejoke
DiscussionReply1.docx

In your responses to your classmates, address the following:

· Evaluate the functions your classmates have listed and suggest ways to incorporate more or combine methods together.

· Hello class,

· I added a divide feature to the code so that you can enter another number in at the end to be used to divide the sum number by. feel free to run it through a few times and give any feedback that you come up with

·  

· #include<stdio.h>

· int add(int x, int y); int divide(int z, int w);

· int main() {    int a, b, c, sum, total;

· printf("enter the first number  -->"); scanf("%d",&a);

· printf("enter the second number  -->"); scanf("%d",&b);

· sum=add(a,b); printf("The sum of two numbers: %d + %d = %d \n",a,b,sum);

· printf("\nNow enter a number to to be used to divide our total  -->"); scanf("%d", &c);

· total=divide(sum,c);

· printf("\nThe answer for %d / %d = %d", sum, c, total);          return 0;    }

· int add(int x, int y) { return x+y; } int divide(int z, int w) { return z/w; }