Quèstion 1 Show the output of the following code. #include using namespace std, int main() int x1, x2. 1,j, k, y z. float f x1= 1, x2%=D1. y 5+x1- z = 5 + ++x2 i-6 % 4, j= 1. J+=j+ 3. k = 25/2. f = (float)(2/5) k)
Q: 1 #include 2 3 int main() 4{ float y; 7 scanf("%f",&y); 8. 9. switch(y) { 10 11 case 1.1: 12 13 14…
A: The solution to the given problem is below.
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 will be the output of the following C++ code? #include using namespace std; int…
A: Question. What will be the output of the following C++ code? #include <iostream>…
Q: Draw a bar chart of 5 values entered by the user (>=0), where the y-axis is along the rows and the…
A: PROGRAM CODE:…
Q: Consider the following code. NOT_Assigned [5, 0, 2, 4, 6, 3, 1] num = alist = val = 0 for i in…
A: Given code: num=?alist=[5,0,2,4,6,3,1]val=0 for i in range(0,num): val=alist[alist[val]]…
Q: PROBLEM: Write a program that prompts the user to input coefficients A, B, and C of a quadratic…
A: #include <iostream>using namespace std; int main(){ int A, B, C; //Declaring variables.…
Q: What is the output of the following code? 1 #include 2 using namespace std; 3 void fun(int…
A: The above question is solved in step 2 :-
Q: What is the printout of the following code? int[][] numbers = {{1}, {1, 2}, {1, 2, 3}};…
A: The output of the given code
Q: Provide the output for the given C++ code about sizes #include using namespace std; int main() {…
A: Given, Code: #include <iostream> using namespace std; int main() { int a = 5; float b;…
Q: 568. What will be the output of the following C++ code? #include using namespace std; int main()…
A: Question 568. What will be the output of the following C++ code? #include <iostream> using…
Q: What will be the output of the following C++ code? 1 #include 2 int main() 4 int p - 123 int t-…
A: task: is to give output of the code provided in the question.
Q: (int score) Returns how many entries in the scoreboard are greater than or equal to the given score.…
A: Q. Use C++ Programming int exemplary(int score) Returns how many entries in the scoreboard are…
Q: Given the following coding, fill in the blank with the "terms" of function as a comment. #include…
A: Given To complete the comment of the given function.
Q: Show the printout of the following code:def f(w = 1, h = 2):print(w, h)f()f(w = 5)f(h = 24)f(4, 5)
A: python function: function in python has a group of related statements which will perform certain…
Q: 8. Determine the value of variable num1, num2 and num3 at the end of the following code. int…
A: #include<stdio.h>int product(int A, int *B) /* function definition. As at the time of calling…
Q: You are creating an application which requires the user to input the precise height of their garage…
A: In the terms of computer programming, the type conversion is referred to as a type casting way that…
Q: What is the output of the following code? 1 #include 2 using namespace std; 3 void fun(int…
A: In this code, at first in the function fun, 5 is added to every element of the second row ie…
Q: Show the printout of the following code: int x = 30;int* p = &x;cout << *p << end1;…
A: Code: #include <iostream> using namespace std; int main(){ int x = 30;int* p = &x;cout…
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: Assume int x-5, y-4; int z= (x<4) ? x++: (--x + (2 y++)): What is the value of z? а. n a. n None of…
A: We are given a programming logic question where we are using ternary operator. In ternary operator…
Q: What will be the output of the following C++ code? #include using namespace std; int main() {…
A: Question. What will be the output of the following C++ code? #include <iostream> using…
Q: What will be the output of the following C++ code int main() { int r = 20; int *p = &r; int q = 10;…
A: #include<iostream> using namespace std; int main() { int r = 20; //declaring an…
Q: give the results of the following statements:
A: I have provided PYTHON CODE along with CODE SCREENSHOT and OUTPUT…
Q: What is the output of the code below? #include int main () { int nums ] {20, 15, 10, 5}: int *x =…
A: Pointer: Pointer are point to the address of a variable. *pointerVariable gives the value of the…
Q: int main() { char c[2] = "A"; } What would the output be if the following code is added…
A: Char array: It contain the character array. Each character store in one after another. The memory…
Q: hat 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; for (i = 0; i…
Q: For the following switch statement; a. What is output by the following code segment if month has…
A: Output: JuneJulyAugustSeptemberOctoberNovemberDecemberError
Q: Suppose int1 and int2 are int variables and dec1 and dec2 are double variables. Assume the following…
A: Output after executing the statement The int variables are int1 and int2 and dec1, dec2 are double…
Q: What is the output of the following C++ code? (2, 3) Submit your answer to dropbox. int count=0;…
A: Given program: #include <iostream> using namespace std; int main() { int count=0; int…
Q: Your task is to complete the code below in order to evaluate the results of four basic arithmetic…
A: Step 1: Declare float variable a and b Step 2: Accept a from user Step 3: Accept b from user Step 4:…
Q: 15. What is the output, if any, of the following C/C++ code? int a[5]=(3,4,5,6,7}; int…
A: Option a is syntax error because of main.c: In function ‘main’: main.c:9:13: warning: initialization…
Q: First, read in an input value for variable numIn. Then, read numIn integers from input and output…
A: The above question is solved in step 2 :-
Q: Show the output of the following codes: i. #include using namespace std; int main() { int…
A: Output for first code ( i ) :
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: Correct and detailed answer will be Upvoted else downvoted. Thank you! What will be the output of…
A: Question. What will be the output of the following C++ code? #include <iostream>using…
Q: Which is correct with respect to the size of the data types? a) char > int float c) char < int <…
A: Question. Which is correct with respect to the size of the data types? a) char > int < float…
Q: 3. What will be the output of the following C++ code? #include using namespace std;…
A: 3. What will be the output of the following C++ ? #include <iostream> using namespace…
Q: can you make a flow chart of this: #include int main(){ int num1, num2;…
A: #include <stdio.h> int main(){ int num1, num2; for(num1 = 1; num1 <= 10;…
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: QUESTION 2 Write one line of code ONLY. Print the value of gpa and its data type in two separate…
A: Step-1: Start Step-2: Declare a variable gpa with value 99.99 Step-3: Print the value of gpa Step-4:…
Q: Show the printout of the following code:t1 = (1, 2, 3, 7, 9, 0, 5)t2 = (1, 3, 22, 7, 9, 0,…
A: Given: Show the printout of the following code:t1 = (1, 2, 3, 7, 9, 0, 5)t2 = (1, 3, 22, 7, 9, 0,…
Q: Question 6 What are the values of x, y, and z after the following code executes? int x = 0; = 1; int…
A: The answer is given below.
Q: (2) ¿ELi * ?What is the output of the program 1 #include using namespace std; int out (int a, int b…
A: 1) a = 50 , b= 20 ,c=30 result = a+b-c; result = 50 + 20 -30; result = 40 Output: Total value of…
Q: Write a program that prompts the user to input three (3) integers: MM, DD, and YYYY. For example, 07…
A: Use a function to check whether year is leap year or not and then an array to save the number of…
Q: Find the error in each of the following code segments and explain how to correct it. а) x = 1; while…
A: a) x = 1; while(x <= 10); x++; } In this code we have several errors: x datatype is…
Q: Run the following C program. What is the value of variable “b” at the end of the program?
A: In fn1, a is the parameter passed to function a = a / 2; //divide a by 2 a = a + 5; //add 5…
Q: What is the output of the following program? #include using namespace std; void…
A: Question. What is the output of the following program? Answer. Code: #include <iostream>…
Q: A) What is the output for the following code? B) Explain what the code is doing. i = 0 mypi = 0.0…
A: The program is trying to find the value of pi using formula π4 = 1 - 13 + 15 - 17 ± The program…
Q: 7. What is the assigned (left-hand side) value in each case? int s, m=3, n=5, r, t; float x-3.0, y;…
A: % is mod operator. It gives remainder after division. other mathematical operators are also used…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- Problem Description: The international standard letter/number mapping found on the telephone keypad is shown below: Write a pseudocode and program that reads a letter and displays its corresponding digit. 2 3 1 ABC DEF 4 5 6 GHI JKL MNO 7 8 9 PQRS TUV WXYZ 0 Write a pseudocode on how you would solve the problem in your own word. Write a java program called Phone considering the following directions. Practice here first then write answer on the answer sheet. Also, make sure distinguish high and low caps as Java is case – sensitive. Import and declare a Scanner class Ask user for an Upper – case letter Use the switch statement along with case and break Use the System.exit(1) in the default to terminate the program Print the corresponding digitWhat will happen when the following code is executed?def SubtractMe(x): k = x - (2/0) if (k <= 6): return 6 else: return kSubtractMe(9)Determine the distance between point (x1, y1) and point (x2, y2), and assign the result to pointsDistance. The calculation is:Distance = SquareRootOf( (x2 - x1)2 + (y2 - y1)2 ) #include <stdio.h>#include <math.h> int main(void) { double x1; double y1; double x2; double y2; double xDist; double yDist; double pointsDistance; xDist = 0.0; yDist = 0.0; pointsDistance = 0.0; scanf("%lf", &x1); scanf("%lf", &y1); scanf("%lf", &x2); scanf("%lf", &y2); /* Your solution goes here */ printf("%lf\n", pointsDistance); return 0;
- Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A,B,C,D,E" is correct. Each question has one correct answer. Thank you. Part 1 - 9. Given the following code, the output is the date and time of __.Calendar cal = Calendar.getInstance(); TimeZone tz = TimeZone.getTimeZone("Europe/Rome");TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");TimeZone tz = TimeZone.getTimeZone("Asia/Istanbul");System.out.println(cal.getTime()); A. the "Europe/Rome" time zone.B. the time zone is computer is currently set to use.C. the "America/Los_Angeles" time zone.D. the "Asia/Istanbul" time zone.E. All of the three listed time zones. Part 2 - 10. Given the following code, the output is the date and time of __. Calendar cal = Calendar.getInstance();TimeZone tz = TimeZone.getTimeZone("Europe/Rome");cal.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));TimeZone tz = TimeZone.getTimeZone("Asia/Istanbul");System.out.println(cal.getTime()); A. the "Europe/Rome"…Programming Exercise 10 in Chapter 6 asks you find the mean and standard deviation of five numbers. Extend this programming exercise to find the mean and standard deviation of up to 100 numbers. Suppose that the mean (average) of n numbers x1, x2, . . ., xn is x. Then the standard deviation of these numbers is:S=sqrt(((x1-x)^2+(x2-x)^2+...+(xi-x)^2+...+(xn-x)^2)/n)7) The ideal gas law allows the calculation of volume of a gas given the pressure(P), amount ofthe gas (n), and the temperature (T). The equation is:V = nRT / PSince we only have used integer arithmetic, all numbers will be integer values with nodecimal points. The constant R is 8.314 and will be specified as (8314/1000). This givesthe same result. Implement the idea gas law program where the user is prompted for andenters values for n, T, and P, and V is calculated and printed out. Be careful toimplement an accurate version of this program. Your program should include a properand useful prompt for input, and print the results in a meaningful manner
- Bulgarian solitaire def bulgarian_solitaire(piles, k): You are given a row of piles of pebbles, all identical, and a positive integer k so that the total number of pebbles in these piles equals k*(k+1)//2, the arithmetic sum formula that equals the sum of positive integers from 1 to k. Almost as if intended as a metaphor for the bleak daily life behind the Iron Curtain, all pebbles are identical and you don't have any choice in your moves. Each move picks up one pebble from each pile (even if doing so makes that pile vanish), and creates a new pile from the resulting handful. For example, starting with[7, 4, 2, 1, 1], the first move turns this into [6, 3, 1, 5]. The next move turns that into [5, 2, 4, 4], which then turns into the five-pile configuration [4, 1, 3, 3, 4], and so on. This function should count how many moves are needed to convert the given initial piles into the goal state where each number from 1 to k appears as the size of exactly one pile, and return that count. These…Twin primes are a pair of prime numbers that differ by 2. Forexample, 3 and 5 are twin primes, 5 and 7 are twin primes, and 11 and 13 aretwin primes. Write a program to find all twin primes less than 1,200. Display theoutput as follows:(3, 5)(5, 7)...Assignment Description This program will simulate part of the game of Yahtzee! This is a dice game that involves rolling five dice and scoring points based on what show up on those five dice. The players would record their scores on a score card, and then total them up, and the player with the larger total wins the game. A Yahtzee score card has two portions: The upper portion has spaces for six scores, obtained by adding up all of the 1's, 2's, 3's, etc. The lower portion has special scores for various combinations: Three of a kind -- at least 3 dice are the same number;the score is the sum of all five dice Four of a kind -- at least 4 dice are the same number;the score is the sum of all five dice Small straight -- four consecutive numbers are represented, e.g. 2345;the score is 25 points Large straight -- five consecutive numbers are represented, e.g. 23456;the score is 30 points Full House -- three of one kind, two of another; the score is 30 points Yahtzee! -- five of a kind; the…
- Module/Week 2 ASSIGNMENT (INPUT/OUTPUT)The number of permutations of a set of n items taken r at a time is given by the following formulan !⁄r !(n-r)!: where n! is the factorial of n, r! is the factorial of r, and (n-r)! is the factorial of the result of n-r. The factorial of a number n can be solved using the following formula: 〖n!=e〗^(-n) n^n√2πn. If there are 18 people in your class and you want to divide the class into programming teams of 3 members, you can compute the number of different teams that can be arranged using this formula (n !⁄r !(n-r)!). Write a C++ program that determines the number of potential team arrangements. You will need to use the double type for this computation. Use the Lab Template you set-up last week, proper formatting, and appropriate comments in your code. The output must be labeled clearly and formatted neatly. Submit C++ Programming Assignment 2 by 11:59 p.m. (ET) on Monday of Module/Week 2.Dry run the following code. You have to complete the iterations and fill the table: #include <iostream> using namespace std; int main(){int m = 10, n =10;int i,j;for(i=1,j=1;i<=m,j<=n;i=i+2,j=j+1){if((i+j) % 2 ==0){cout<<m*(i-1)+j;j=i+j;}else{cout<<n/(i+1)+j;j=i*j;}}cout<<end1;return 0;}nstructions The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. An example of the program is shown below: Enter the amount of your check >> 12.99 Enter the amount of your friend's check >> 9.50 The tip should be at least $1.9485 The tip should be at least $1.425 Task 1: The DebugThree1 class compiles without error. Task 2: The calcTip() method calculates a 15% gratuity. Task 3: The DebugThree1 program accepts user input and displays the correct output.