code output to the screen
Q: Suppose you were given the following code segment: int a[5] = { 1, 2, 4, 8, 16 }; int *p = a; int…
A: Concept of array and pointer is being used here, I have defined everything in comments of code , and…
Q: What is the output of the following code: #include int main(int argc, const char * argv[]) {…
A: Question. What is the output of the following code: #include <iostream> int main(int…
Q: 5c. What will be the output of the following C++ code? #include int main(int argc, char const…
A: Given, Code: #include<stdio.h>int main(int argc, char const *argv[]){char a =…
Q: Given the following code and output: int a[] = {10, 20, 30, 40}; cout << a << endl; Example Output…
A: Please find the answer to the above question below:
Q: a the game of basketball, there are 5 players on a team, and each team plays a game consisting of…
A: It is defined as Basketball games are played a set amount of time. It's different for different…
Q: A- Given the declaration: int main () int x; int p; int q; return 0; mark the following statements…
A: Answer: Valid Invalid Valid Valid Invalid
Q: Q.4) What is the function of the following C++ Programs? Part A #include #include main () #include…
A: 1. Function of the program is to find average of 7 numbers 2. Function of the program is to find…
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: The output of this program is:(6,8,5) #include using namespace std;void add (int a,int b){int…
A: The function add is multiplying the parameter values and printing its value and this will be the…
Q: HW 2: Identifiers and assignments (associated with lectures 5, 6 and 7) Write a program that will…
A: C Program for above : #include <stdio.h> int main() { //get user input…
Q: Q3. A power distribution company charges its consumers depending on the type of customer: 1- Class A…
A: C program to calculate the total payable amount by a customer on the power consumption. There are…
Q: A student wrote the following function to find the minimum and maximum number between two values a…
A: Answer: A student wrote the following function to find the minimum and maximum number between two…
Q: #include using namespace std; int g = 100; int main() { int a; { int b; b = 20; a = 35; g…
A: Given, C++ code: #include <iostream> using namespace std; int g = 100; int main() { int…
Q: Write a program that will calculate and print out bills for the city water company. The water rates…
A: Note: Programming language is missing in the question. So we will answer this program in C++. If you…
Q: Q#05: Write output of the following program and remove error if you find any #include using…
A: There are few errors in the code which have to changed. for (i=1;;) --> for statement should be…
Q: What will be the output of the following C++ code? #include using namespace std; int main() { int…
A: Given, Code is given in C++ language. Code: #include <iostream> using namespace std; int…
Q: Please answer as soon as you can. What will be the output of the following C++ code?…
A: Given, Code: #include <iostream> using namespace std; main() { double a = 21.09399;…
Q: What is the output of the following program? #include using namespace std; int x = 5; int…
A: Question. What is the output of the following program? #include<iostream> using namespace…
Q: #include using namespace std; int main() { int a = 5, b = 10, c = 15; int *arr[ ] = {&a, &b,…
A: Dear learner hope you are doing well !, I will try my best to answer this question. Thank You!!
Q: 2. A) What could go wrong with the following code? double x = 4.12345 double z = 4.12; double y =…
A: Kindly Note: As per our guidelines we are supposed to answer only one question. Kindly repost other…
Q: In Python Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon…
A: def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon):…
Q: Examples3: write e++ program to add two integet equal 6 and the second number equal 8? #include…
A: #include<iostream>//header file using namespace std; int main()//main method { int a=6;//…
Q: 6.29 LAB: Max and min numbers Write a program whose inputs are three integers, and whose outputs are…
A: Answer: step 1: take three inputs step 2 : define two functions one for finding largest among three…
Q: Q1. Write a C++ program which initializes the earning of an employee. The program should calculate…
A: NOTE: As per the guidelines, we are allowed to answer only one independent question per post. Kindly…
Q: 16. Consider the following code: ot her = True 1 - int (input (OMumber: )) if other and x > 0: print…
A: Answer: Code: other = Truex = int(input("Number: "))#taking user input#condition checking to print…
Q: Write the final output generated by the following program: b. #include #include void main() { int…
A: This question comes from Programming Language in C which is a paper of Computer Science. Let's…
Q: In each of the following code snippets, data is copied from x to y. How many bytes of data are…
A: SUMMARY: -Hence, we discussed all the points.
Q: A student wrote the following function to find the minimum and maximum number between two values a…
A: #include <iostream>using namespace std; void minMax(double a, double b, double &min,…
Q: 1.Write program to iteratively compute Fibonacci numbers (named after an Italian mathematician).Some…
A: Program code: //include the required header files #include<iostream> //std using namespace…
Q: 17 If aValue, i, and n are type int variables, what does the following program fragment do? aValue =…
A: In the code fragment n value is 10 The loop is iterating from i=10 to i=1 When i is lessthan or…
Q: 7.18 LAB: A jiffy A jiffy" is the scientific name for 1/100th of a second. Define a function named…
A: Algorithm: 1. Take Input. 2. Read the function and return userJiffies/100. 3. Display Output to 3…
Q: Q2) A store asks you to write a C program to make cash payment easier for cashiers. Write a C…
A: We have to write a code about payment system
Q: Please complete the following function printBox, which accepts three parameters (i.e., char c, int…
A: Here is the detailed and simplified code for the above listed problem statement:
Q: What the output from executes this program? #include "iostream" using namespace std; int main() {…
A: Please find the answer below :
Q: What will be the output of the following C++ code? #include using namespace std; int main()…
A: Given, Code: #include <iostream> using namespace std; int main() { int i, j; j = 10; i =…
Q: what is the output of the following code segment? int x = 350; int y = 0; do { y +=x 0; X = x/10; }…
A: Question: what is the output of the following code segment? int x = 350; int y = 0; do { y +=x 0; X…
Q: What will be the output of the following C++ code? #include using namespace std; int main()…
A: const keyword in c++ fix the value of variable in program.
Q: What is the output of the following code segment? int num cin>>x; = 20, 5, X; if (x >= 2*num) y+=1;…
A: While doing programming in any programming language, you need to use various variables to store…
Q: Part B In C++, if the statement ( int a=5, b=2; ) is written at the beginning of the program, then…
A: As per our guideline simple questions are present in a single image, supposed to solve only three…
Q: What is the value of t1 after execution of these statements if the value of t2 is as follows: char…
A: Lets see the solution.
Q: 7. Write a function that evaluates the area of a pentagon. Use "math.pi", for pi, and "math.sqrt"…
A: Area of pentagon Pentagons can be convex or concave, regular or irregular. One with equal sides and…
Q: 3.13 LAB: Exact change Write a program with total change amount as an integer input, and output the…
A: coded in python to get the above output of exact changes (Python Language)
Q: Modify the craps program to allow wagering inside of C#, and explain each step (reject if you…
A: After updating the code, I have provided C# CODE along with CODE SCREENSHOT and OUTPUT…
Q: . What will be the output of the following C++ code? #include using namespace std;…
A: Question 10. What will be the output of the following C++ code? #include <iostream> using…
Q: What will be the output of code given below. #include using namespace std; int main() { int n=12;…
A: In given code a loop is there which runs until value of n is not zero. Since initial value of n is…
Q: Modify the craps program to allow wagering inside of C#. Initialize variable Balance to 1000…
A: Solution:: package april.april16; import java.util.Random; import java.util.Scanner; public…
Q: What will be the output of the following program in C++? #include using namespace std; int x = 1;…
A: Given, Code: #include<iostream>using namespace std;int x = 1;int main(){int x = 2;{int x =…
Q: We have 100 critics who have rated the top movie of the year: Enchantio! Write a C++ program that…
A: Given ratings 99, 76, 54, 67, 91, 86, 92, 94, 53, 93, 91, 98, 67, 93, 90, 64, 51, 56, 62, 56, 71,…
Q: 8. What will be the output of the following C++ code? #include using namespace std;…
A: Code: #include <iostream> using namespace std; int main() { //declaring…
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";
Step by step
Solved in 2 steps
- Q13/ Write a program in c++ that asks the user to input two numbers. If the first number entered is greater than the second number, the program should print the message: "The first number is greater." Otherwise, it should print the message: "The first number is smaller." .By using functionsd. Given that an int variable s has been initialized, write a statement(s) that declares a new variable andassign it the remainder of 9 times 8 less than s divided by 4. e. Write a statement(s) that initializes the variables named a, b, c and d to false, ''one'', 'y' and 87.9respectively09. Paint Calculator Write a C program that allows the user to enter values for the width and length of a wall in feet and price per gallon of paint. Assume that a gallon of paint covers 350 square feet of a wall. The program outputs the area of the wall in square feet, the number of gallons needed and the cost of the job.
- Q3, A lecturer intends to separate his students into 2 groups based on their INDEX Numbers, those with odd numbers in group A and EVEN numbers in B. Use if-else statement to implement this. Q4.Your son intends to randomly mention some numbers to you, write a program using While or do-whileloop that will print all the numbers and the sum of the positive numbers.4. During each summer, John and Jessica grow vegetables in their backyard and buy seeds and fertilizer from a local nursery. The nursery carries different types of vegetable fertilizers in various bag sizes. When buying a particular fertilizer, they want to know the price of the fertilizer per pound and the cost of fertilizing per square foot. The following program prompts the user to enter the size of the fertilizer bag, in pounds, the cost of the bag, and the area, in square feet, that can be covered by the bag. The program should output the desired result. However, the program contains logic errors. Find and correct the logic errors so that the program works properly. // Logic errors. #include #include using namespace std; int main() { double costs double area; double bagsize; cout > bagsize; cout > cost; cout > area; cout << endl; cout << "The cost of the fertilizer per pound is: $" << bagsize / cost << endl; cout << "The cost of fertilizing per square foot is: $" << area / cost << endl; return 0; }Write C++ statements that accomplish the following. Declare int variables x and y. Initialize x to 25 and y to 18. Declare and initialize an int variable temp to 10 and a char variable ch to 'A'. Declare and initialize a double variable payRate to 12.50 Copy the value of an int variable firstNum into an int variable tempNum Declare int variables to store four integers.
- 3. Write a program to take input for a number, if the number is palindrome, then display its half on the screen, otherwise take input for 2 more numbers, and display their product on the screen. Use minimum two functions including main function.C++ Programming Exercise: A real estate office handles, say, 50 apartment units. When the rent is, say, $600 per month, all the units are occupied. However, for each, say, $40 increase in rent, one unit becomes vacant. Moreover, each occupied unit requires an average of $27 per month for maintenance. How many units should be rented to maximize the profit? Write a program that prompts the user to enter: a. The total number of of units. b. The rent to occupy all the units. c. The increase in rent that results in a vacant unit. d. Amount to maintain a rented unit. The program then outputs the number of units to be rented to maximize the profit.Let A={8,9,10}, B={9,10,11,12,15} and C={9,10}. Which of the following statements are true? a) d) {2,5} ⊆ A e) φ ⊆ C
- Display the first N magic numbers, where N is a positive number that the user provides as input. Here, a magic number is a number whose sum of its digits eventually leads to 1. For example, 1234 is a magic number because 1 + 2 + 3 + 4 = 10 and 1 + 0 = 1, while 1235 is not (1 + 2 + 3 + 5 = 11 and 1 + 1 = 2). Write a program that prints out the first N magic numbers, seven on each line. You are required to use the following function prototype: bool isMagic(int value); // Returns true if value is a magic number The outline of this function will be as follows: Step 1: Calculate the sum of digits of the value Step 2: Repeat Step 1 until we get a single-digit Step 3: If the resulting sum is equal to 1 then it is a magic number, otherwise not Here is the sample output:Consider the following function: int test(int x, int y) { if (x == y) return x; else if (x > y) return (x + y); else return test(x + 1, y - 1); } What is the output of the following statements? a. cout << test(5, 10) << endl; b. cout << test(3, 9) << endl;what is the output of the following c++ statement: int a, b, c, d; a = 5; b = 4; c = (++b + a--); cout << a << " " << b << " " << c << endl;