With the statement, int a=1; With the statement, while(a<=5){ int x=1; a++; while(x<20) { printfl"%d Xt=2:
Q: /rite a program that will ask the user to continuously enter a number until such time that the…
A: In step 2 I have pasted the python code, please go through it.
Q: Each code example is incorrect. Indicate why! (2 errors each) 1. if (i=0)// //...code…
A: Computer programming or the code is the communication between computers and users. Creating a code…
Q: Multiple Choice: In the following code, how does the value of x or y change after exeCuting public…
A: While doing programming in any programming language, you need to use various variables to store…
Q: Body Mass Index (BM) is a measure of health on weight. It can be calculated by taking your weight in…
A: Here is the java code. See below step for code.
Q: Q2: If you know that the marks should be included as follows: Brand The ratio A 100-90 B 90-80 C…
A: As the programming language is not mentioned here, we are using PYTHON The code and output…
Q: Write a program that prompts the user to enter the number of hours a car is parked at the airport…
A: Assuming the formula, Parking fee, F is calculated as 5, 0 ≤ h ≤3F = {6 ×int (h+1),…
Q: Guess-the-number-game: Write a program that pays the game of “guess the number” as follows: Your…
A: Since the programming language is not mentioned in the question, we will answer this question in the…
Q: 1- Get a number from user. 2- If the number is not divisible by 5 then find out how much more you…
A: Summary: In this question, we have to write a program in C++. In the program, we have to take a…
Q: QUESTION 10 public static int foo(int a, String s) s = "Yellow"; a=a+2; return a;
A: local variables concept:- When variables are holding values within a block and then after it losses…
Q: Type a Python calculator-like program (program idea: asks the user to enter two numbers, then the…
A: Given: Q: Type a Python calculator-like program (program idea: asks the user to enter two numbers,…
Q: int gcd(int a, int b); An example run of your program is as follows: Enter the number to start…
A: Answer: I have done code and also I have attached code and code screenshot as well as output
Q: Tuary. deposit is then made of £1000 at the end of every month for the next 12 months. Interest is…
A: a. Code: amount=zeros(1,12);amount(1)=100000;interest=zeros(1,12);fprintf('Month\tInterest…
Q: Each of the following definitions and program segments has errors. Locate as many as you can and…
A: void showValues(int nums[ ]) *// Definition of the function showValues. { for (int…
Q: def foo(num): if (num<=0): return else: print(num/2,end=" ") foo(int(num/2)) print(num/2,end=" ")
A: To do: Output of the given code
Q: The great circle distance is the distance betweentwo points on the surface of a sphere. Let (x1, y1)…
A: Note: Programming language is missing in the question. So we will answer this program in Java…
Q: Description Note: You must use the values given and you must not "hard-code" results. Write a Java…
A: logic:- read n if n>=18 display “person can vote” else display “person cannot vote” end.
Q: (Guess the Number Game) Write a program that plays “guess the number” as follows: Your program…
A: A TextBox should be used to input the Number to TextBox1 input the guess. to TextBox2…
Q: #include int main (void){ int score; printf("Please enter a score (between 100 and 0)> "); scanf…
A: Please find the answer below
Q: Show the output of the following code:
A: a> ans: Program a after execution ,its output will be null. Because we have given amount=5;…
Q: You have to 2 ints from the user( a and b) & print their sum on the console. However, sums in the…
A: Please find the answer below :
Q: What is the range of values that x can hold after this statement is executed? double x =…
A: Answer:A perform is increasing within the same vary wherever it's spinoff is positive. Now, notice…
Q: Write one line of code ONLY. Use concatenation to print the variables given below in one line with a…
A: python code: A="Artificial"I="Intelligence"print(A +" " + I)
Q: dentify and correct the error int main(void) { double x = 12.8 double y Follow the code.
A: Basically the error was in both the cout lines , which have incorrect quotes, Hence facing empty…
Q: Find error in program include void main() { int x = 10; int y = 15; printf("%d", (x, y)) }
A: The error is at line no. 4: In this line the semi-colon is missing at the end. Below is the correct…
Q: #include int main() { int x = 1; if (x > 0) printf("inside if\n else if (x > 0) pnint f("incide…
A: The output of the given c code
Q: Jump to level1 Write multiple if statements: If car_year is before 1967, print "Probably has few…
A: NOTE: Since programming, langauge is not mentioned. Therefore answering questions in Python…
Q: (Compute e) You can approximate e* using the following series: x? x ex = 1 + 1! 2! 3! 4! n! Write a…
A: PROGRAM CODE: #include <iostream> // include header file for input output…
Q: atures of the water. The formula to compute the energy is Q = M * (finalTemperature –…
A: Code: import java.util.Scanner; public class Main { public static void main(String[] args) {…
Q: int getNunO; "accepts input fron the user. "/ 1. 2 3 void display(int nun); 4 5. /*prints the…
A: getNum() function: int getNum() { /*accepts input from the user*/ int…
Q: QtAnswer the following (you are free to (assign the variables) sqrt(x)+abs(-20) S=…
A: let x=9 y= 5.5
Q: Q: Write a program that reads non-negative integer number and determines whether it is odd or even…
A: Q1) The semicolons should be commas The correct answer is Option d Answer: In for loop the 3…
Q: (b) A triangle can be classified based on the lengths of its sides as equilateral. isosceles or…
A: Algorithm for the code: Step 1: Declare three sides of the triangle. Step 2: Enter three sides at…
Q: A bug collector collects bugs every day for 7 days. Write a program that keeps a running total of…
A: A bug collector collects bugs every day for 7 days. Write a program that keeps a running total of…
Q: Q2: If you knew that the signs should be listed as follows: The universal ratio Brand The ratio…
A: As the programming language is not mentioned here, we are using PYTHON The complete code and output…
Q: Financial application: compute future apartment rent) Suppose that the rent for an apartment is…
A: The problem is based on finding the rent of the apartment using programming. NOTE: The code is…
Q: C++ main(){int i; int j; int y; i=9;j=3; y=(i/j)-(3*i^2)/9; cout<<y;}
A: #include <iostream>using namespace std; int main() { int i; int j; int y; i = 9;…
Q: 5-WRITE A PROGRAM THAT CALCULATES A STUDENT'S AVERAGE IF IT IS LESS THAN 50, SPECIFYING THE…
A: As per company guidelines we are suppose to answer only 1 question. Kindly re-post other…
Q: Q4: (Find the two lowest scores) Write a program that prompts the user to enter the number of…
A: GIVEN: Create a Java program that prompts the user to enter the number of students and each…
Q: Irite a program that prompts the user to input an integer between 0 and 35. If the number is less…
A: #include <iostream>#include <iomanip> Below is the code for a given requirement using…
Q: rite a program to accumulate the "x" deposits made in a month in a savings account, include in the…
A: Given Question, Write a program to accumulate the "x" deposits made in a month in a savings account,…
Q: Write and test a program that computes the area of a circle
A: The implementation of the program in Python 3 is as follows: SOURCE CODE: PI = 3.14 radius =…
Q: Java example to check if number is palidrom or not Number will be entered by the user
A: Given: Java example to check if number is palindrome or not Number will be entered by the user
Q: 26.Temperature Conversion Write a program which prompts the user for a Fahrenheit temperature,…
A: the program is written below:- print("Enter 'x' for exit."); fah = input("Enter Temperature in…
Q: // This program gets student names continuously until XXX is entered. Then, for each student, quiz…
A: All the return boxes should be connected under one box.
Q: Write a program in python that asks the user to enter a word and then capitalizes every other letter…
A: PROGRAM CODE: st = input("Enter the string: ") // take original string from…
Q: The monthly payment for a given loan pays the principal and the interest. The monthly interest is…
A: public static void main(String[] strings) { Scanner input = new Scanner(System.in);…
Q: 3. The formula for determining compound interest is: A represents the amount to earn; P is the…
A: According to bartleby guidelines we need to answer only one question so i have answered first…
Q: The monthly payment for a givenloan pays the principal and the interest. The monthly interest is…
A: Program code: //import the required packages import java.util.Scanner; //define a class public…
Please answer the two questions! I'll rate!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 3 images
- Suppose that the input is 0 0 8 12 50 7 13 –1. What is the output of the following code? (2, 3) Submit your answer to dropbox. int num, sum, count cin>>sum; cin>>count; cin>>num; while(count<=4) { sum=sum+num; count++; cin>>num; } cout<<"Sum="<<sum<<endl;At a coffee shop , a coffee cost $1. Each coffee you purchase, earns one star. Seven stars earns a free coffee. In turn, that free coffee earns another star. Ask the user how many dollars they will spend, then output the number of coffees that will be given and output the number of stars remaining. Use A loop. Please Write in Java and use the test case examples as reference.At a coffee shop , a coffee cost $1. Each coffee you purchase, earns one star. Seven stars earns a free coffee. In turn, that free coffee earns another star. Ask the user how many dollars they will spend, then output the number of coffees that will be given and output the number of stars remaining. Use A loop. Please Write the code in Java and use the test case examples as reference.
- PLEASE SOLVE BOTH 2.) and 3.) 2.) What will be displayed when the following code is executed?int number = 6;while (number > 0) {number -= 3;System.out.print(number + " ");}a. 6 3 0b. 6 3c. 3 0d. 3 0 -3e. 0 -33.) Which of the following loops correctly computes 1/2 + 2/3 + 3/4 + ... + 99/100?A:double sum = 0;for (int i = 1; i <= 99; i++) {sum = i / (i + 1);}System.out.println("Sum is " + sum);B:double sum = 0;for (int i = 1; i < 99; i++) {sum += i / (i + 1);} System.out.println("Sum is " + sum);C:double sum = 0;for (int i = 1; i <= 99; i++) {sum += 1.0 * i / (i + 1);}System.out.println("Sum is " + sum);D:double sum = 0;for (int i = 1; i <= 99; i++) {sum += i / (i + 1.0);}System.out.println("Sum is " + sum);E:double sum = 0;for (int i = 1; i < 99; i++) {sum += i / (i + 1.0);}System.out.println("Sum is " + sum);What is the output of the following code snippet?int main(){int num1 = 10;int num2 = 5;int num3 = 200;num3 = num3 % (num1 * num2);cout << num3 << endl;return 0;}a) 0b) 4c) 10d) There will be no output due to a run-time error.IN java please For each code segment below, determine how many times the body of the loop isexecuted. Write one of the following answers after each: 0, 1, infinite, or >1. Note that ”> 1” means more than once but not infinite. If you think there isa syntax error in each part, you can correct it to answer the question. Eachpart is separate and not related.(a) for(int x=1; x<=5; x++){System.out.println(x);x= x+ 1;}(b) int x=2*40;while(x>5){System.out.println(x);}(c) int x*=1%10;do{x = x*2;} while(x>=4);(d) int x*=4+10;while(x==5){System.out.println(x);x=x-1;}(e) int x=1;while(x<=5){x = x*2;x+=1;}
- Given that x = 0, what is the output of this code #include <stdio.h> int main (void) { int x; printf ("enter an integer number between 0 and 2\n"); scanf("%d",&x); switch (x) {case 0: printf(" the number is low\n"); break; case 1: printf("the number is ok\n"); case 2: printf("the number is high\n"); } }What is the result of the following code? int xNum T 0; int yNum = 0; do { xNum = xNum+yNum; yNum += 1; cout << "xNum: } while (xNum > 2); << xNum; O a.xNum: 2 is printed O b. no output, the loop is never executed O c. xNum: 0 is printed O d. endless loopGiven two numbers that represent the lengths of a right triangle's legs (sides adjacent to the right angle), output the length of the third side (i.e. hypotenuse) with two digits after the decimal point. Output each floating-point value with two digits after the decimal point, which can be achieved by executingcout << fixed << setprecision(2); once before all other cout statements. Ex: If the input is: 3.0 4.0 the output is: Hypotenuse: 5.00
- Suppose that the input is 20 -16 -5 15 6 0. What is the output of the following code? int num;int temp = 0;cin >> num;while (num != 0){if (num % 2 == 0)temp = temp + num;elsetemp = temp - num;cin >> num;}cout << "temp = " << temp << endl;1. Write the code to check if y is between 80 and 100 (including 80 and not including 100)? Answer: 2. Given that x = 2, what is the output of this code #include <stdio.h> int main (void) { int x; printf ("enter an integer number between 0 and 2\n"); scanf("%d",&x); switch (x) {case '0': printf(" the number is low\n"); break; case '1': printf("the number is ok\n"); case '2': printf("the number is high\n"); } } Answer: WRITE C REPL1 .Write a program that prints out three different tic tac toe winning results. Make each one bigger than the last, separated by more spaces and lines: 2. Write a program called TriangleArea, which calculates and outputs the Area of a triangle with a Base value of 3.5 and a Height value of 4.85. The formula for the area of a triangle is: 1/2 ×???? × ????ℎ?. Your program should output the correct answer. 3. Write a program that will tell me the conversion of 60 miles, into kilometers. Remember that 1 mile is 1.60934 kilometers. 4. Write a sequence of output statements to display your initials (2 – 3 letters) using a cool pattern for each letter. For example, here is a simple pattern for the initials IL: II LL II LL II LL II LL II LL II LL II LL II LL LL LL LL Use around 8 statements to complete this exercise. 5. Write a program that asks the user to input a number. Then…