How many lines of output will be displayed on the screen after the following program is executed?
Q: What will be the output of the following program? a=15 a=a-5 while a<=10: print(a,"NCT") a=a+1 print…
A: As per company guidelines, we are supposed to answer only 1 question at a time. Kindly, post 2nd…
Q: 2) In football, a touchdown counts as 6 points, an extra point after a touchdown counts as 1 point,…
A: #include<stdio.h> int main(){ int td,s,ep,f,total; printf("Number of touchdowns: ");…
Q: What is the output of the program? *
A: Define header file <iostream> for io operations. Define function out with 3 int parameters a,…
Q: Exercise 5: Write a single program to perform the following M=((W+X) – Y) * Z
A: #include <iostream>using namespace std; int main(){cout<<"......Reading the…
Q: 4)Write program that input the user age and print the sentence: a) You are child if the age is less…
A: There is not mentioned any programming language so I used JAVA Step 1 : Declare a variable age and…
Q: This is a segment of program, when it executed with multiple values for n and s the program displays…
A: Given code: #include <iostream> using namespace std; int main(){ int x, y; int f;…
Q: You want your program to execute statement 1 when A is false, B is false, and C is true, and to…
A: Justification: “No”, it will not do what the user want because, the condition provided in the “if”…
Q: 1 #what is the output when the following is executed? 2 E for x in range (1, 6): for y in range (x):…
A:
Q: Write an LMC program that generates the Fibonacci series. Write a Little Man program that prints…
A: LMC Program that generates the Fibonacci series Answer : Code: INP STA N LOOP LDA…
Q: Write a program that displays a random uppercase letter using the time.time() function. Python…
A: We have to use time.time() in python programming to print a random uppercase letter.
Q: write a program to execute the four operations according to the following * .design
A: Code: Dim a As IntegerDim b As IntegerDim res As Integer Private Sub Command1_Click()res =…
Q: 4. Write a program that prompts the user to enter a greeting and a name. The program should output…
A: The above program makes use of Scanner class defined in java.util package. This class takes in user…
Q: How many times will the value in y be displayed in the following program segment ?
A: Output:…
Q: use c++ Write a program that prompts the user to enter the number of seconds, displays a message at…
A: The complete C++ code is given below with code and output screenshots Thread is used here...
Q: 3. Write a program that displays the following pattern: ***** *** * *** *****
A: As no programming language is mentioned, it is solved using basic C++
Q: Write a line of code to output the following: "This is the Exam prep".
A: You just need a single line of code to prit the output The statement varies from one programming…
Q: Write down a program that will take a year as input and will print number of days in that year.
A: #include <iostream> using namespace std; int main() { //declaring variable int…
Q: Write a program t
A: Here, we need to write a program to compute the value of S: Where S = 8A + sin2B if X = 1 OR S =…
Q: Write a program prints the following form: *** ***** ******* **********
A: C++ Program for Above : #include <iostream>using namespace std;int main() { int space =…
Q: Q6/A: Draw the flow chart for a program that reads, calculates, and prints any temperature? B: Draw…
A: algorithm:- Input n temperature from user. calculating:- total sum value and then calculating…
Q: A code segment is intended to display the following output. up down down down up down down down…
A: When we encounter repeating patterns in the required output, rather than declaring that particular…
Q: Exercise 1: In this exercise we are asked to write a program that prompts the user for a positive…
A: Input n if(n>0) { while(n>0) { r=n%10; //find remainder…
Q: (b) Below is part of a code, consider this program and show where each part of code is saved in the…
A: Given: Below is the part of a code , Consider this program and show where each part of code is…
Q: write a program that uses input to prompt a user for their name and then welcomes them. Enter your…
A: CODE: name = input("Enter your name: ") print("Hello", name) OUTPUT: Enter your name: Chuck Hello…
Q: what is the output of the following code segment: int num = 12; while(num >= 0) { if(num % 5 == 0) {…
A: To find the output for the given code. int num=12; while(num>=0) { if(num % 5 == 0)…
Q: in the program what will be the result
A: Given program: #include <iostream> using namespace std;class test1{ private: int…
Q: What will the following program display?
A:
Q: What will the output be after the execution öf thiS ToFivo(int num1):
A: CODE 1 :
Q: What is the output of the program
A: The do/while loop is a variant of the while loop. This loop will execute the code block once before…
Q: Write what will be printed on the computer screen after execution This part of the program: Dim…
A: The machine has completed the startup process: This same BIOS chip instructs it to hunt for a…
Q: What is the output of the following code snippet? Please ensure your answer is spaced according to…
A: The output of the following code- 1 2 3 5 8 13 Note: Option 1 and 3 are identical in the image.…
Q: Write the exact output that you expect to see on the screen when the indicated statements are…
A: Given :
Q: Which one of the following changes to the program modelled below will be the easiest to make?
A: A class diagram depicts a static structure of classes, their operations, methods, and relationships…
Q: int a = 12; int b = 22; System.out.println(!(a >= b) || !(b>=a));
A: Given Question: If the expression's result is TRUE, write TRUE, and if the expression's output is…
Q: What is the output of the following code segment: int x = 9; int y = 1; while (x != 0) { x/= y; x++;…
A: Given data:-
Q: What are the variables and conditional/looping statements that are used on the program?
A: A variable is a name given to a memory location. It is the basic unit of storage in a program. The…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- what are the values of the variables when runned? int j,kboolean mj = 1k = j++m = (++k == j++) ------------------ int x = 3if (x == 2)x= 0if (x==3)x++elsex+=2 --------------- how many times will it be looped for(int x = 0; x== 2; x++){//body of the loop}Count Dracula buys blood from tha public (AIDS tested, of course).But since he prefers certain types to others, he pays as follows:Type A 3000Type B 1800.75Type C (FOR AB) 2880.25Type 0 1500Write a program to input clients name, his/her blood type,and the volume (liters) of blood extracted. Loop exits wheninputted blood type is invalid. Output how much each customer will be paid. java (switch statement)Create the generated machine code from snippet code as follow: int i=10, j, x;for (a=10; a>0; a--) {if (a % 2 == 1) i += a;else i /= 2;j = i*2;}x = i+j; please solve max in 30 minutes thank u
- C Languagge: 1. What will be printed from the following program segments? (5 points each)a. for (int x = 1; x <= 20; x++){for (int y=1; y<=5; y++)printf("%d", x);printf("\n");} //forb. for (int x = 20; x >= 1; x--){printf("%d\n", x);x--} //forc. x = 12;do{printf("%d\n", x);x--;}while (x<7); 2. What is the output of the following program segment? (5 points each)a.int count =0;while (count++ < 10)printf("This loop can repeat statements\n");b.int count =5;while (--count > 0)printf("\t%d",count); 3. Assume that the following code is correctly inserted into a program: ( 5 pointseach)int s = 0;for (i = 0; i < 5; i++){s = 2 * s + i;printf("%d\n", s);}a. What is the final value of s?b. If a semicolon is inserted after the right parenthesis in the for loopstatement,what isthe final value of s?c. If the 5 is replaced with a zero in the for loop control expression, what isthe final value of s?1. How many stars are outputed when the following code is executed? for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) printf("*"); } 2. What is the output when the sample code below is executed? int main() { int x=0; while(x 6) continue; printf("%d", count); } }Java code Ever wondered how change is disbursed to customers in certain stores? In country X the following notes exists 200,100,50,20,10 and following coins: 5, 1, 50c, 10c, 5c. For the sake of this exercises let us only consider change below 50 see below example: Sample run 1: Enter item name: Apples Enter QTY of Apples: 2 Enter price per item N$: 3.25 Amount tendered N$: 50 Your change is: N$ 43.50 Disbursed as follows: 2 x N$20; 0 x N$10; 0 x N$5; 3 x N$1; 1 x 50c; 0 x 10c; 0 x 5c [Hint: make use of % and / operators to determine the values needed]
- Consider the block of code below and find how many times line 8 gets executed when input has values: 5, 6, 11, 12 int input;bool ok = true; while( ok ){ cin >> input; if( input > 6 || input < 9 ) ok = false; // line 8}Which of the following is true when comparing sentinel loops and user confirmation loops? Select one: a. Both types of loops may not iterate at all. b. A user confirmation loop can do no iterations, but a sentinel loop has to iterate at least once. c. A user confirmation loop iterates at least once, but a sentinel loop can do no iterations. d. Both types of loops must iterate at least once.Analyze the following code: Code 1: int number = 45;boolean even; if (number % 2 == 0) even = true;else even = false; Code 2:int number = 45;boolean even = (number % 2 == 0); a. Code 1 has compile errors.b. Code 2 has compile errors.c. Both Code 1 and Code 2 have compile errors.d. Both Code 1 and Code 2 are correct, but Code 2 is better. What is the output from System.out.println((int)Math.random() * 4)?a. 0b. 1c. 2d. 3e. 4 Given |x - 2| <= 4, which of the following is true?a. x - 2 <= 4 && x - 2 >= 4b. x - 2 <= 4 && x - 2 > -4c. x - 2 <= 4 && x - 2 >= -4d. x - 2 <= 4 || x - 2 >= -4 Given |x - 2| >= 4, which of the following is true?a. x - 2 >= 4 && x - 2 <= -4b. x - 2 >= 4 || x - 2 <= -4c. x - 2 >= 4 && x - 2 < -4d. x - 2 >= 4 || x - 2 < -4 What is the output of the following code? boolean even = false;System.out.println((even ? "true" : "false")); a. trueb. falsec. nothingd. true false
- The correct answer to the following question is: I. Why is IV not correct? Which of the following code segments will produce the displayed output? 122333444455555 I. for (int i = 1; i <= 5; i++) { for (int j = i; j > 0; j--) { System.out.print(i); } System.out.println(); } II. for (int i = 0; i < 5; i++) { for (int j = 0; j < i; j++) { System.out.print(i); } System.out.println(); } III. for (int i = 1; i < 5; i++) { for (int j = i; j > 0; j--) { System.out.print(i); } System.out.println(); } IV. for (int i = 1; i < 6; i++) { for (int j = 0; j < i; j++) { System.out.println(i); } } V. for (int i = 0; i < 5; i++) { for (int j = 0; j < i; j++) { System.out.print(i+1); } System.out.println();1. What is the output of the code segment below? Hint: Draw a 2x3 grid and then fill it in. int[][] plot = new int[2][3]; for (int s = 0; s < 2; s++) for (int t = 0; t < 3; t++) plot[s][t] = t - s + 3; for (int s = 0; s < 2; s++) { int sum = 0; for (int t = 0; t < 3; t++) sum += plot[s][t]; System.out.print(sum + " "); } 2. What is the output of the code segment below? int[] arr = {1,2,3,4,5,6,7,8}; for (int yy = 0; yy < 4; yy++) for (int xx = 1; xx >= 0; xx--) System.out.print(arr[yy * 2 + xx] + " "); 3. What is the output of the code segment below? int[] c = {5,6,7,8,1,2,3,4}; int n = c[5]; c[c[4]] = c[c[n - 1]]; c[n + 1] /= 2; c[0] += c[c[6]]; for (int p = 0; p < c.length / 2; p++) System.out.print(c[p] + " "); 4. What is the output of the code segment below? for (int s = 1; s < 5; s++) { for (int t = s; t > 0; t--) System.out.print(t + " "); System.out.println(); } 5. What is the output of the code segment below? int me = 1; int you = me; int…Implement a game of Pig where the user plays against a "hold at 20 or goal" computer player that rolls until a 1 ("pig") is rolled, or the turn total is greater than or equal to 20, or the score plus the turn total is greater than or equal to 100. The first player is chosen randomly. An empty input (i.e., Enter) indicates that the user wishes to roll. Any entered line of non-zero length indicates that the user wishes to hold. Before the game, randomly select which player the user will be, and print the line "You will be player #.", where # is the user's player number. Then, print an instruction line "Enter nothing to roll; enter anything to hold." Before each turn, print a line with "Player 1 score: " and player 1's score. Print another line with "Player 2 score: " and player 2's score. Finally, print a line with "It is player #'s turn.", where "#" is replaced by the current player number. Play starts with player 1 and then alternates. For each roll, print a line with "Roll: "…