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
Concept explainers
Question
error_outline
This textbook solution is under construction.
Students have asked these similar questions
Give all possible final values of variable × in the following program. Explain.int x = 0; sem s1 = 1, s2 = 0;
co P(s2); P(s1); x = x*2; V(s1);
|| P(s1): x = x*x; V(s1);|| P(s1); x= x+3; V(s2); V(s1);Â
oc
What is the output of the following program segment?
long long num =5;
int i;
for (i=1; i<3; i++)
{
num= num + num * (num - i);
cout<< num<<"";
}
cout<<endl;
If you run the following program, in which order the statements of this program will be executed? Your answer should be a sequence comma separated of line numbers without any extra spaces, e.g., 1,2,3,4,5,6,7,8 etc. What will this code print out?
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- In each of the following code snippets, data is copied from x to y. How many bytes of data arecopied? The answer should be a C expression.Example: int x[10], y[10];...for (int i=0; i<10; i++)x[i] = y[i];Answer: 10*sizeof(int)Example: int *x, *y; ...; y = x;Answer: sizeof(int*) (e) int x=10, y=x;(f) int x[10]; int *y = x;(g) int x[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};void f(int y[5]) { ... }int main() { f(x); }(h) int x[10], y[10];...memcpy(y, x, 5*sizeof(int));arrow_forwardto b? What value will be assigned to c?4. What will the following program display?def main():x = 1y = 3.4print(x, y)change_us(x, y)print(x, y)def change_us(a, b):a = 0b = 0print(a, b)main()arrow_forwardWrite a complete program that will receive 50 integers, and display to the screen their sum, and average. You have to use a for the problem. You have to use Clanguage. No points will be given if other programming languages are usedarrow_forward
- C++ What does the following segment of code output to the screen (be precise)? int a = 3;        if (a % 2)             cout << "* * * * * * * *\n" ;      cout << "* * * * \n";      a = 4;       if (a % 2)             cout << "* * * * * * * *\n";      cout << "* * * *\n";arrow_forwardModify the program that computes floor area to compute and output the number of12-inch square tiles needed to tile the floor.arrow_forwardGiven the following program segment: int first = 3; int second = 4; int j; for ( j = 1; j <= first; j++) {    cout << second * j <<endl;   second= second + (j - 1); }  cout << endl; Your task is to write a while loop and a do ... while loop which will produce the same output.arrow_forward
- Correct and detailed answer will be Upvoted else downvoted  What is the output of the following program? And Explain ? #include<stdio.h> main(){ char s[20] = "Hello\0Hi";printf("%d %d", strlen(s), sizeof(s));}arrow_forwardWhat will be the output of the below program  X = 10 y = 2 X = X + 2 y = y + 2 print ( " y " ) 2 y error 4arrow_forwardWrite a program that prompts the user to enter an integer from 1 to 7 and displays a pyramid, as presented in the following sample run ---arrow_forward
- Write a program whose inputs are three integers, and whose output is the smallest of the three values. Ex: If the input is: 7 15 3 the output is: 3  ''' Type your code here. '''arrow_forwardWrite a program that prompts the user to enter the minutes (e.g., 1 billion), and displays the number of years and days for the minutes. For simplicity, assume a year has 365 days. Use C++ program.arrow_forwardPlease use python The following equations estimate the calories burned when exercising (source): Women: Calories = ( (Age x 0.074) — (Weight x 0.05741) + (Heart Rate x 0.4472) — 20.4022 ) x Time / 4.184 Men: Calories = ( (Age x 0.2017) + (Weight x 0.09036) + (Heart Rate x 0.6309) — 55.0969 ) x Time / 4.184 Write a program using inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output calories burned for women and men. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('Men: {:.2f} calories'.format(calories_man)) Ex: If the input is: 49 155 148 60arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Introduction to Operators in C; Author: Neso Academy;https://www.youtube.com/watch?v=50Pb27JoUrw;License: Standard YouTube License, CC-BY