What will be printed after executing the following C++ code? int x=60, y=7, z=2; for (int k=10; k >8; k--) { if (z <= 0) { cout << "$$" << x % y ; x -= 2; } else { cout << "$$" << x / y ; y += 2;} }
Q: Write a program dist.c that calculates the distance between two points and prints the result on the…
A: The program that takes command-line arguments while executing the program. The number of arguments…
Q: What is the output of the following 'C' program? main() { extern int a; printf("\n%d",a); } int…
A: In this question we have to find the output of the following C program
Q: What will be output of the following c code? #include const enum Alpha { X, Y=5, Z }p=10; int…
A: The output of the following c code is -4 #include<stdio.h>const enum Alpha{X,Y=5,Z}p=10;int…
Q: Which of the following C programs is likely to cause a segmentation fault? a) #include #include…
A: Ans: The following c program that is likely to cause a segmentation fault is: a) c #include…
Q: Modify the C# code given below so that the output of the program is y=5. Note: You can make…
A: A C# program is given and we need to modify the code so that the output is y = 5.
Q: Lion king from the jungles of Hakuna Matata likes random numbers. Let F4(X) be the number of digits…
A: Given Data:
Q: A) What will be the value of x after the following code is executed? int x, y = 4, z = 6; x =…
A: A) The value of x after the given code is executed
Q: What is the value stored at variable "x" after executing the following code segment double vol[3]…
A: The above program finds sum of all elements in the 2D matrix except a[2][j] elemnts So, the sum of…
Q: // What is the coutput of the following statement: int x, y, z; double w, t; x 17; y = 15; x = x +…
A: According to the Question below the Solution:
Q: In C++ 2.12 LAB: Hypotenuse Given two numbers that represent the lengths of a right triangle's…
A: Algorithm: The algorithm for the given problem is: Start Initialise two variables Read the values…
Q: Given the following code, what is the final value of x? int x=1, y=2, z=3; bool w=true; x=w=y-z;
A: #include <iostream> #include <string> using namespace std; intmain(void) { int x = 1,…
Q: What is the output of the following C++ programs? Part A # include # include # include # include…
A: Both the above programs have two header files included. One is iostream.h, which is for input/output…
Q: Suppose that x and y are of type int, z is of type double, and ch is of type char. Consider the…
A: Given:
Q: Write a program dist.c that calculates the distance between two points and prints the result on the…
A: Include necessary header files. Function is declared with parameters. Declare main function. Using…
Q: Write a C++ program that calculates the due amount for a cellular telephone bill. The cell company…
A: Here is the c++ code: See below step for code:
Q: Write a C program that reads in the mass of two bodies and the distance between them and then…
A: Using const keyword, we can declare a constant. Here we are dealing with decimal values and as…
Q: #include int main() { int a[] = {5, 4, 3, 2}; int total = 0; for(int i = 0; i < 4; i++)…
A: Given question is based on c programming and is asking for the output of given code.
Q: Write a program dist.c that calculates the distance between two points and prints the result on the…
A: Include necessary header files. Function is declared with parameters. Declare main function. Using…
Q: What is the output of the following C++code? int x = 15; int y = 3; if (x + y > {y = x -x = y…
A: The given code contain several syntax error: int x = 15; int y = 3; if (x + y > { //error 1y =…
Q: Question 5 What will be printed after executing the following C++ code? int x=60, y=7, z=2; for (int…
A: Following will be printed after executing abov code: 886
Q: What is the output of the following C++ code: int alpha [8]; for (int k =0; k 0)…
A: The given code throws errors. Error1: i is not declared
Q: Q4)What will be the output for this code(Explain your logic with help of dry running for the same)…
A: The output will be 101. This program contains a main function and another function named foo. foo…
Q: The exact output produced after executing the following C++ code is intr = 10; void check(int &a,…
A: Explanation:- As the value of h will be passed by reference in the check funtcion. Hence all the…
Q: convert the follwing c++ program into pep/9 assembly language and show the screen shot of pep/9 code…
A: MNEMONICS USED: ADDSP: Add to stack pointer (SP). Memory allocated for local variables at run-time.…
Q: What is the output of the following code when embedded in a complete C++ int secret (int x) { } int…
A: #include <iostream>using namespace std;int secret(int x) // function prototype{ int i=2*x,…
Q: What will the following C-program print? #include int main() { int x = 5; printf("%d %d\n", ++x,…
A: This mcq is based on c programming.
Q: What is the output of the following C++ code? #include using namespace std; class X { int m;…
A: Given the C++ program, the output of that program is given below with explanation.
Q: Write output of the following c++ code by completing it with explanation of all iterations. Code…
A: Here in the main method, we have defined a variable x of type integer. Now we have a call to…
Q: What would be the output of the following C code? int main(void) { int x, y; int * ptr; x=100; ptr…
A: Explanation:- Initially x is loaded with 100. Then the reference of x is stored in ptr. Then y is…
Q: Write the output of the following C++ code? #include using namespace std; class rect { int x, y;…
A: Que. Write the output of the following C++ code? Ans. Given, Programming language = C++ Code:…
Q: CAN YOU CONVERT FROM C TO C++? #include #include #include int r_pc[3] = {0, 0, 0}; int…
A: code is given below;
Q: def aaa(p): return p ** 3 print("more defs". def bbb(q): return q // 16 def ccc(p, q): print(aaa(p))…
A: I have given justication of this code below in detail.
Q: Write a code using C++ for the given prompt: A contractor orders, say, 30 cubic yards of premixed…
A: #include <cmath> #include <iostream> using namespace std; int main() { double…
Q: Q3. a) Write a program to find the resultant (R) of two forces F1 & F2 with angle 0 between them as:…
A:
Q: What will be the results of the following program? (write the result of every line and the final…
A: ANSWER:
Q: Write a program that will calculate and print out bills for the city water company. The water rates…
A: using System;class HelloWorld { static void Main() { double gallons,bill=0; char code;…
Q: In python, create a program, "change.py", that has a function that takes 4 arguments that correspond…
A: We assume A penny is worth 1 cent A nickel is worth 5 cent A dime is worth 10 cent A…
Q: 2. Fibonacci sequence is series of numerical terms where each term depends on two previous terms…
A: Solution: Given,
Q: Given the following C/C++ code: int x = 1; int foo() { return x; } int bar() { int x = 2; return…
A: Given C++ code int x = 1; int foo() { return x; } int bar() { int x = 2; return foo(); } int…
Q: Write a program that will obtain the following integer values from the user: - the date broken down…
A: According to the Question below the Solution: Program Output:
Q: Given the following C++ code snippet, what is the output? Your answer must be exact. int vals[4] 0;…
A: The program consists of an array vals, a variable accum and a pointer pvals. Values stored in vals…
Q: What is the output of the following C++ code? (2, 3) Submit your answer to dropbox. inti=1; int…
A: Given code is written below as complete program for convenience. File name: “main.cpp” //Include…
Q: Write a program that inputs values of type char, short, int, & long the values in union variables of…
A: the code is as follows:-
Q: What is the output of the following C++ code? const double PI = 3.14159;double cylinderRadii[5] =…
A: The program is used to find the volume of the cylinder of the given inputs and print the results.…
Q: Q4: Write a FORTRAN90 program that reads a student ID and his GPA out of 4.0. The program should…
A: Algorithm: Start Read student ID and GPA If gpa>=3.5 then print "EXCELLENT" Else if gpa<3.5…
Q: Write a C++ program that calculates the due amount for a cellular telephone bill. The cell company…
A: Below I have provided C++ Programming. Also, I have attached the screenshot of the code and output…
Q: Can this code be made to news all the way to the cheese and displayed with a "*" instead of finding…
A: Here is the detailed answer of the given problem:
Q: What is the output of the following C++ code?double salary[5] = {35700, 96800, 55000, 72500,…
A: Output of above code. If you are using the setprecision then you will need to include the required…
Q: Write a JAVA program that determines the alert level for the COVID-19 based on the percentage of new…
A: Algorithm: Start Read number of new cases nCases Read number of PCR cases pcrCases Calculate…
Step by step
Solved in 2 steps with 1 images
- In C++ Programming. Solve the following problem statements by simulating the given values of the variables below. int X = 5, Y = 10, Z = 15; int A = 2, B = 4, C = 6; 1. If X = Y; X = Z what is the value of X? 2. If B = C; A = X; Y = Z what is the value of A? 3. If A = B; B = C; C = X what is the value of A? 4. If Z = Y; Y = X; Y = Z what is the value of Z? 5. If X = B; X = C; what is the value of X?Write a c program dist.that calculates the distance between two points and prints the result on the screen. The cartesian coordinates of the points would be given in the command line as 6 parameters. Your program should check if the number of arguments provided is correct and that the six coordinates are valid numbers of type double .dist.exe x1 y1 z1 x2 y2 z2 For example, to calculate the distance between the two points (0, 0, 0) and (1, 1, 1), the program would be run as: dist.exe0 0 0 1 1 1Write a c program dist.that calculates the distance between two points and prints the result on the screen. The cartesian coordinates of the points would be given in the command line as 6 parameters. Your program should check if the number of arguments provided is correct and that the six coordinates are valid numbers of type double .dist.exe x1 y1 z1 x2 y2 z2 For example, to calculate the distance between the two points (0, 0, 0) and (1, 1, 1), the program would be run as: dist.exe0 0 0 1 1 1 and the screen output would be 1.73205
- . Write a c++ program that tells what coins to give out for any amount of change from 1 cent to 99 cents. For example, if the amount is 86 cents, the output would be something like the following: 86 cents can be given as 3 quarter(s) 1 dime(s) and 1 penny(pennies) Use coin denominations of 25 cents (quarters), 10 cents (dimes), and 1 cent (pennies). Do not use nickel and half-dollar coins. Your program will use the following function (among others): void computeCoin(int coinValue, int& number, int& amountLeft); Note that: 0 < coinValue < 100; 0 <= amountLeft < 100. For example, suppose the value of the variable amountLeft is 86. Then, after the following call, the value of number will be 3 and the value of amountLeft will be 11 (because if you take three quarters from 86 cents, that leaves 11 cents): computeCoins(25, number, amountLeft); Write a driver program to test your function. Include a loop that lets…In C++ Write a program that can be used to calculate the federal tax. The tax is calculated as follows: For single people, the standard exemption is $4,000; for married people, the standard exemption is $7,000. A person can also put up to 6% of his or her gross income in a pension plan. The tax rates are as follows: If the taxable income is: Between $0 and $15,000, the tax rate is 15%.Between $15,001 and $40,000, the tax is $2,250 plus 25% of the taxable income over $15,000.Over $40,000, the tax is $8,460 plus 35% of the taxable income over $40,000. Prompt the user to enter the following information:Marital statusIf the marital status is “married,” ask for the number of children under the age of 14Gross salary (If the marital status is “married” and both spouses have income, enter the combined salary.)Percentage of gross income contributed to a pension fund Your program must consist of at least the following functions:Function getData: This function asks the user to enter the…i have this c code its a bouncing ball game and it has a paddle to make the ball bounce back but it is not working. how to fix it? #include <stdio.h>#include <stdlib.h>#include <time.h> // Define constants for the screen size and ball velocity.#define SCREEN_WIDTH 60#define SCREEN_HEIGHT 20#define BALL_VELOCITY 1#define CENTER // Variables to keep track of position and speed of ballint x = 0;int y = 100;int x_speed = 5;int y_speed = 5;// Variables to keep track of paddleint x_paddle = 250, y_paddle = 370;int paddle_width_half = 40;// score keepingint score = 0;int width;int key;int LEFT;int RIGHT;int keyPressed;int keyCode; // Called every re-draw, defaul 30 times per secondvoid draw() { // Update position by adding speedx = x + x_speed;y = y + y_speed;if (y < 0)y_speed = -y_speed;if (x > width || x < 0)x_speed = -x_speed; // Check if keys are pressedif (keyPressed) {if (keyCode == RIGHT || key == 'd') {// Move paddle rightx_paddle = x_paddle + 8;}else if…
- This is for c++. I need a program that asks whether any members of your party are vegetarian, vegan, or gluten-free, then displays only the restaurants that you may take the group to.C++, How do I write a program that asks how many tickets for each class of seats were sold, then displays the amount of income generated from ticket sales? Class A costs $15, Class B costs $12, and class C costs $9.Modify the following C code to get the given output: #include <pthread.h> #include <semaphore.h> #include <stdio.h> /* This program provides a possible solution using mutex and semaphore. use 5 Fsrmers and 5 ShopOwner to demonstrate the solution. */ #define MaxCrops 5 // Maximum crops a Farmer can produce or a Shpoowner can take #define warehouseSize 5 // Size of the warehouse sem_t empty; sem_t full; int in = 0; int out = 0; char crops[warehouseSize]={'R','W','P','S','M'};//indicatig room for different crops char warehouse[warehouseSize]={'N','N','N','N','N'};//initially all the room is empty pthread_mutex_t mutex; void *Farmer(void *far) { /* 1.Farmer harvest crops and put them in perticular room. For example, room 0 for Rice(R). 2.use mutex and semaphore for critical section. 3.print which farmer is keeping which crops in which room inside the critical section. 4.print the whole warehouse buffer outside of the critical section */ }…
- In the C++ code below, what is the explanation: - why there are 2 getlines in the string name? (what will happen if only one?) - since there is an if statement, why is there no else statement? #include <iostream> using namespace std; int main() { int n; // uer input cout << "Enter number of students: "; cin >> n; string gender[n], name[n]; // input for name and gender for (int i = 0; i < n; i++) { cout << "Enter gender of Student: "; cin >> gender[i]; cout << "Enter name of Student: "; getline(cin, name[i]); getline(cin, name[i]); } cout << "---------------------" << endl; cout << "List of Female Students" << endl; // printing female students for (int i = 0; i < n; i++) { if (gender[i] == "Female") cout << name[i] << endl; } cout << "List of Male Students" << endl;…Write a C program that compute the perimeter of Circle, Rectangle, Triangle and Square. The program asks the user to specify the shape as follows: C for Circle, S for Square, R for Rectangle and T for Triangle and then it reads the required value to compute the perimeter for that specified shape. Note: the perimeter for the shapes:????l? = ? × ?????? × ?S????? = ? × ????????????? = ? × (????? + ??????) ???????? = ????? + ????? + ????3What is the output of the following C++code? int x = 15; int y = 3; if (x + y > {y = x -x = y +cout << x << " " << y << " " << x + y << " " << y - x << endl;}else{x = y - x + y %5;cout << x << " " << y << " " << x - y << " " << x + y << endl; }