Explanation of Solution
Given: The user passes 3, 5, 4, 6 as inputs in the following
#include
//Function Declarations
int strange(int x, int y);
int main(void)
{
//Local Declarations
int a;
int b;
int c;
int d;
int r;
int s;
int t;
int u;
int v;
//Statements
scanf("%d %d %d %d", &a, &b, &c, &d);
r=strange(a,b);
s=strange(r,c);
t=strange(strange(s,d), strange(4,2));
u=strange(t+3, s+2);
v=strange(strange(strange(u, a), b),c);
printf("%d %d %d %d %d", r, s, t, u, v);
return 0;
}//main
// = = = = = = = = = = strange = = = = = = = = = = =
int strange(int x, int y)
{
//Local Declarations
int t;
int z;
//Statements
t=x+y;
z=x*y;
return (t+z);
} //strange
To find:Â The output of the aforementioned program for the given inputs, 3, 5, 4, and 6.
Solution:
The aforementioned program will display the following output:
23 119 12599 1537565 184507919
The following are the descriptions for determining the output:
In the above program, firstly, the header file is included, and then the function, strange, is declared, which has two integer parameters...
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Computer Science: A Structured Programming Approach Using C, Third Edition
- This is an computer programming question The code should be in C++ Create a namespace student having following members:a)student_id, student_name, course_code, course_title,obtained_marks, grade, gpab) Create a function void calculate_grade() to calculate the gradeaccording to the criteria given below:c) Create a function void display_grade() to display the graded) Create a function void calculate_gpa() to calculate the GPAe) Create a function void display_gpa() to display the GPAIn the main() function, take appropriate inputs and display the completeinformation of the student.arrow_forwardC++ Write a void function that has two parameters: a value parameter called num that receives a floating point number from the calling function and a floating point reference parameter called result. The functions should do this calculation: 25.0 * num + 37 and store the answer in result. Do not do any read or write operations in the function.arrow_forwardc++, print the outputarrow_forward
- Describe scenarios where passing function objects as arguments can be beneficial.arrow_forwardIn C Languegearrow_forwardC++ printSmaller is a function that accepts two int parameters and returns no value. It will print the value of the smaller one parameters. The function protoype is as follows: void printSmaller(int num1, int num2); write the statments to read two integers and call this function to display the smaller one.arrow_forward
- C++arrow_forward#include using namespace std; || function declaration int max(int num1, int num2); int main () { // local variable declaration: int a = 100; int b = 200; int ret; I| calling a function to get max value. ret = max(a, b); cout num2) result = num1; else result = num2; return result; }arrow_forwardC PROGRAM Reverse + Random Formula In the code editor, there's already an initial code that contains the function declaration of the function, computeReverseNumber(int n) and an empty main() function. For this problem, you are task to implement the computeReverseNumber function. This function will take in an integer n as its parameter. This will get the reverse of the passed integer and will then compute and return the value: result = (original_number + reverse_of_the_number) / 3 In the main() function, ask the user to input the value of n, call the function computeReverseNumber and pass the inputted value of n, and print the result in the main() with two (2) decimal places. SAMPLE: Input n: 20 Output: 7.33 Input n: 123 Output: 148.00arrow_forward
- Code Should Be In C++arrow_forwardUsing C++ Programming language: Assume you want a function which expects as parameters an array of doubles and the size of the array. Write the function header that accepts these parameters but is defined in such a way that the array cannot be modified in the function. You can use your own variable names for the parameters.arrow_forwardIt is c++ please solve within 30 minutes and avoid plagiarism make it different from others which already available on internet.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education