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 3, Problem 25PS

Explanation of Solution

Given: The following code is given:

int a;

int b;

a = b = 50;

printf("%4d %4d",a,b);

a = a *2;

b = b / 2;

printf("%4d %4d", a, b); 

To Find: The output of the following code.

int a;

int b;

a = b = 50;

printf("%4d %4d",a,b);

a = a *2;

b = b / 2;

printf("%4d %4d", a, b);  

Solution:

The following code on being run will display the following output.

50 50 100 25

The program declares a and b as variables.

The reserved word, int, indicates a and b with integer values stored in the computer.

In the second step, the program store the values of a and b, that is, 50...

Blurred answer
Students have asked these similar questions
What is the output of the following code segment? int n = 1;do {       cout << n << '  ';      n++; } while (n >= 5)   What is the output of the following code segment? int n = 1;do {       cout << n << '  ';      n++; } while (n <= 5);
Question 5 What is the output of the following code segment? int num cin>>x; = 20, 5, X; if (x >= 2*num) y+=1; else if (x >= num) y+=2; if (x
What will be printed out as a result of the following code?int x = 5, y = 7;System.out.println(++x);x += y++;System.out.println(x + "," + y);   a. 66,8   b. 613,8   c. 513,8   d. 512,7

Chapter 3 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
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,