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.
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
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
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...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
#include <stdio.h>int main() { int x = 5866, y = 5455; int z = x; x = y; y = z; printf("%d %d", x, y); return 0;}
Give output of this c code.
what is the output of the following code segment?
int x = 350;
int y = 0;
do
{
y +=x 0;
X = x/10;
}
while (x!=0);
cout<
5- What is the output for y?
int y = 0;
for (int i = 0; i< 10; ++i)
{
y +=i;
}
cout << y;
Chapter 3 Solutions
Computer Science: A Structured Programming Approach Using C, Third Edition
Ch. 3 - A unary expression consists of only one operand...Ch. 3 - The left operand in an assignment expression must...Ch. 3 - Associativity is used to determine which of...Ch. 3 - Side effect is an action that results from the...Ch. 3 - Prob. 5PSCh. 3 - Prob. 6PSCh. 3 - Prob. 7PSCh. 3 - Prob. 8PSCh. 3 - Prob. 9PSCh. 3 - Prob. 10PS
Ch. 3 - Which of the following statements about mixed...Ch. 3 - Which of the following statements about compound...Ch. 3 - Prob. 13PSCh. 3 - Prob. 14PSCh. 3 - Which of the following is not a binary expression?...Ch. 3 - Prob. 16PSCh. 3 - If originally x=4, what is the value of x after...Ch. 3 - Prob. 18PSCh. 3 - Prob. 19PSCh. 3 - What is the value of each of the following...Ch. 3 - Given the following definitions, which of the...Ch. 3 - If originally x=2,y=3,andz=2, what is the value of...Ch. 3 - Prob. 23PSCh. 3 - If x=2945, what is the value of each of the...Ch. 3 - Prob. 25PSCh. 3 - Prob. 26PSCh. 3 - Write a program that reads two integers from the...Ch. 3 - Write a program that extracts and prints the...Ch. 3 - Prob. 29PSCh. 3 - Write a program that calculates the area and...Ch. 3 - Prob. 31PSCh. 3 - Prob. 32PSCh. 3 - Write a program that changes a temperature reading...Ch. 3 - Write the C code for each of the following...Ch. 3 - Prob. 35PSCh. 3 - Write a program that converts and prints a...Ch. 3 - Prob. 37PSCh. 3 - Write a program that prompts a user for an integer...Ch. 3 - Prob. 39PS
Knowledge Booster
Similar questions
- What's wrong with this code? float q;int *p;q = 100.7;p = &q;arrow_forwardint x = 8, y = 3, z = 5; x += x + y * z + z * z; printf("%i\n", x); // what is the outputarrow_forward#include <stdio.h> int main(){float a =3e-1,b=2e-2;printf("a=%f b=%f",a,b);return 0;} note : what is e is here , explain brefily and what is output of the code.arrow_forward
- X ، معلومات الدخول الى د Quiz: FinalExam quizzes/4585/take/questions/74430 Question 9 2 pts What is the output of the following code? (NOTE: There are no spaces between the output) void test () { static int x = 0; int y = 1; X = X + 2; y =y + 13; cout<arrow_forward#include using namespace std; int main () int x, y; { X = 5; y = ++x cout << x << y; %3D ++x; %3D x = 5; y = x++ * ++x; cout << x < y; return e; } 525636 747953 749735 636636arrow_forwardGiven the following declaration: int x; int* p; Which of the following expressions is allowed? Select one: a. p = x; b. p = &x; %3D C. p = *x; d. x = p;arrow_forward#include main() {int=a, b=2, x=0, x=a + b * a + 10/2 * a, printf("value is =%d", x);} What is the value?arrow_forwardAfter the following code is executed, what is the value of i? int i;int *p;p = &i;i = 1;*p = 2;arrow_forward#include <stdio.h>int a=5; int main(){int x;x = ~a+a&a+a<<a;printf("%d",x);return 0;} Give output of this codearrow_forwardIn c void f (int *p, int * const q) { p=q *p=3; *p=4; } int i = 1, j =2; int main(){ f(&i, &j); printf("%d %d",i,j); return 0; } a. The program prints 1 2 and terminates b. the program prints 1 3 and 0 c. the program prints 1 4 and terminates d. the program prints 3 4 and terminates e. the program has compiler errorarrow_forward#include <stdio.h> int main(){printf(" enter two integers and ill add them \n"); int integer1;int integer2; scanf("%d,%d",&integer1, &integer2); int sum;sum = integer1+integer2; printf("sum is %d\n", sum); return 0; } when i run this code the sum is incorrect like when i type in 44 55 it says the sum is 109. whats wrong with the code?arrow_forwardGiven the following code, what is the value of *p? int i;int *p;i = 5;p = &i;arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
Recommended textbooks for you
- 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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education