Question: Type the code below into Visual Studio and run it. Describe what is happening here. Now, add a new function in this program. Perhaps you
Type the code below into Visual Studio and run it. Describe what is happening here. Now, add a new function in this program. Perhaps you want to subtract the two numbers or multiply them, or find the greater or lesser than values. Make sure to upload your code and that it contains the original add function as well as the one you created.
#include
int add(int x, int y); // function prototype
int main()
{
int a, b;
int sum; //declares the variables used in the program
printf(Enter the first number :); //prompt to input the first number
scanf(%d, &a); // stores the first number in variable a
printf(Enter the second number:); //prompt to input the first number
scanf(%d, &b): // stores the second number in variable b
sum = add(a,b); //function call
printf(The sum of two numbers is: %d , sum); //displays the sum after executing add function
printf(The value stored in the variable sum is: %d ,sum); //displays the value store in the variable
sum
return 0;
}
int add(int x, int y) //function definition
{
Return x +y;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
