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;}
#include using namespace std; void myfunction(int num2, int num1); lint main() { my function (5,2); return 0; } void myfunction(int num1, int num2) {if (num1>3) cout << "A1"; else if (num1<3) cout<<"A2"; else cout<<"A3";} O A2 O A1 O A3 A1 A2 A3
Use the code provided to you to do the following: 1) Write code that implements the function withdrawal. 2) Deposit 1000 into checking account. 3) Deposit 500 into saving account. 4) Withdraw 100 from checking account. 5) Get balance for both checking and saving account and display the amounts. #include <iostream> usingnamespace std; class BankAccount{ private: float balance; public: BankAccount(); void Deposit(float); void WithDrawal(float); float getbalance(); };

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