Computer Science: A Structured Programming Approach Using C, Third Edition
Computer Science: A Structured Programming Approach Using C, Third Edition
3rd Edition
ISBN: 9780534491321
Author: Behrouz A. Forouzan, Richard F. Gilberg
Publisher: Course Technology, Inc.
Expert Solution & Answer
Book Icon
Chapter 4, Problem 26PS

Explanation of Solution

Given: The user passes 3, 5, 4, 6 as inputs in the following program:

#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...

Blurred answer
Students have asked these similar questions
C++ Functions provide a means to modularize applications Write a function called "Calculate"  takes two double arguments  returns a double result   For example, the following is a function that takes a single "double" argument and returns a "double" result double squareArea(double side){   double lArea;   lArea = side * side;   return lArea;}
What does & mean when it is used as part of a type declaration of a function parameter? The parameter is to be passed by value The parameter is to be passed by reference O The parameter is declared to be a pointer The parameter's address cannot be modified by the function
C programing    Given the function below, what would the function call question3(10, 101) return? int question3(int a, int b) {if (a == 0) return b;if (b == 0) return a;return question3(10*a+b%10, b/10);}

Chapter 4 Solutions

Computer Science: A Structured Programming Approach Using C, Third Edition

Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education