Correct the syntax errors in the following program, and rewrite the program so that it follows our style conventions. What does each statement of your corrected program do? What output does it display? /* * Calculate and display the difference of two input values *) #include int main(void) {int X, /* first input value */ x, /* second input value */ sum; /* sum of inputs */ scanf ("%i8i"; X; x); X + x = sum; printf("&d + 8d = %d\n"; X; x; sum); return (0);}
Q: What is wrong with the following programs? 1 int main() 2 {3 for (int i = 0; i < 10; i++); 4…
A: There are two errors in the given program: The semicolon in line 3 at for loop. end1 in line 4…
Q: If you run the following program, in which order the statements of this program will be executed?…
A: Order of execution tells the flow of control in program. Function call can alter the flow of…
Q: The parking charge per hour at SMBC underground parking is as follows: •P 35.00 - minimum charge for…
A: Objective: This program computes the parking fee for a parking space. The total number of years will…
Q: When analyzing data sets, such as data for human heights or for human weights, a common step is to…
A: The answer is
Q: One of the downsides of using expressions that produce results other than true or false is it…
A: True false outcome expression are easy to use in conditional statements.
Q: How would I go about this? Please write the pseudocode and the python code for the following task:…
A: START DECLARE fruit list, vegetables list, protein list FOR i = 0 to 3 INPUT fruit list FOR i =…
Q: the programming langauge is Java. (Sort three integers) Write a program that prompts the user to…
A: Non-decreasing order is the increasing order. Read three numbers from the user using three different…
Q: Write a program that prints the following diamond shape. You may use printf statements that either a…
A:
Q: Is the Input Factory Full Value? Create a function that checks whether the given number is a total…
A: Algorithm: Start the program. Read the input from user. call the function to calculate the…
Q: QUESTION 10 def cube (number): for i in range (number, number): for j in range (number) : print…
A: In place of FILL THIS PART just write number*number*number Hence the answer to be filled in the box…
Q: Find the Logical or Syntax Errors in the following program Q1: int main() { cin>> x;…
A: In computer programming, there are two types of errors such as: Logical error: It is difficult to…
Q: What is the value of i and j after the execution of the following code i = Math.ceil(-2.1); j=…
A: Correct Option is (a) i=-2 and j=3
Q: he files provided in the code editor to the right contain syntax and/or logic errors. In each case,…
A: import java.util.*; public class DebugSeven2 { public static void main(String[] args) {…
Q: what are the two wrong answer = int (input ("What is your name?")) if name == "Charlotte":…
A: answer = int (input ("What is your name?")) if name == "Charlotte": print ("so nice name")…
Q: d. What is wrong with this program given below? Write it. #include void sqr_it ( int name); int…
A: 1) This program calculates the square of a numbers It decalare a function sqr_it with parameter…
Q: What is printed out by the program below if the execlp() finishes successfully? #include int main…
A: Dear Student, execlp uses a function with variable arguments. Two const char * are needed. The…
Q: PRG-Computer Fundamentals and. What will be the output of the following program? include int main()…
A: According to the Question below the Solution:
Q: Consider the following statement: int* p, q; This statement could lead to what type of…
A: The problem is based on the basics of pointers in programming languages.
Q: Jump to level 1 The following code reads in a value for variable numPlums and then prints some…
A: code : - #include <iostream> using namespace std; int main(){ // decleration of the…
Q: he following code isn't working correctly and I am unable to figure out why. The for loop is never…
A: srandom((unsigned)time(NULL) + my_rank);value = random() % 10;if (my_rank % divisor ==…
Q: ld you please explain the following program with detai
A: include<stdio.h> standard input-output library. struct is the keyword and clientData is the…
Q: The following code is syntactically correct meaning it will compile. for (int k=0; k<10; k++) {…
A: Answer: False EXPLANATION: Error in following code:
Q: Considering the following code segment, which of the statements is correct about it? Assume there is…
A: initially, num = 90. as *ptr = &num; so, *ptr = 90 as, num is not equal to 900…
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: What would be displayed by the following program? (The symbol '#' stands for a space character.)…
A: The output of the code is-: Is it 37.6101.1170?
Q: 1- Write a java program that asks the user to input two integers intStart and intEnd then computes…
A: 1) read start and end value 2)Iterate n from 10 to 100 with step size 10 3)in above loop, For…
Q: The homework is to re-write the previous program so that the user does not need to enter any…
A: The homework is to re-write the previous program so that the user does not need to enter any…
Q: Q2. (a) Using Java Development Kit (jdk) and text editor, write a println statements to produce the…
A: The compound assignment operators are combination of simple assignment operator and a binary…
Q: What will be the output when the following code segment is executed? public static void main(String…
A: //here is the output before function call a,b,x,y are 3 2 0 5before function call a,b,x,y are 3 2…
Q: Q2: Write a brief description to each line in the following programs, and determine the output of…
A: Given a program instructions in C that will find the given integer is even or odd :- if (n%2==0) //…
Q: Trace the following code by showing the values of the 3 variables in the table on the right, for…
A: <Code in java Script> let $x= 1; console.log($x) //$x will be 1 let $y = 2;…
Q: Complete the following program that collects an input word from the keyboard and finds if the word…
A: Solution Code word = input("enter")is_palindrome = Truei=-1for j in range(len(word)): if word[j]…
Q: What is wrong in the following program? void p(int i){ cout << i << end1; } int…
A: Explanation: In the code given, both function signatures have identical function name p(int).…
Q: 7. Write a complete Java program (including import statements, comments and all variable…
A: Code: import java.util.Scanner; public class Main { public static void main(String[] args) {…
Q: Task 03 Write a program which stores a large number in AX, stores another smaller number in BX. Now…
A: the program is given below:-
Q: Trace the following program showing the values of i, j, and z ?at each step void main() { int i=0,…
A: Outer while loop will go from i=0 till i=5 Inner loop will start from j = 0 to j=4,…
Q: Write a program to check the divisibility of two numbers. Use the concept of default argument here.…
A: Required: Write a program to check the divisibility of two numbers. Use the concept of default…
Q: void main () { int x, у, z; x =10; y = 17; z = x + y; y = y - x; printf ("x: %d, y: %d, z: %d", x,y,…
A: initially, x = 10 and y = 17. so , z = x + y = 10 + 17 = 27. ( z = 27 ) and y = y - x = 17 - 10 =…
Q: Write a program that performs as a very simple calculator. Your calculator should be able to handle…
A: GIVEN: Write a program that performs as a very simple calculator that handles the four basic math…
Q: Q2 : Draw the flow chart for the following program, and; What does this program print ( follow the…
A: Given c++ program
Q: Carefully consider the code segment below and answer the following questions : int result =0;…
A: In the given code snippet, we can see that result variable is initialized with 0. The loop will run…
Q: Modify the program to also print the powers of 2 for 2^20 and 2^30. And label 2^10, 2^20, 2^30 as K,…
A: Code : #include <stdio.h> #include <math.h> //Main function int main() { int i=0,…
Q: What is the output of this program? #include int main() { int i, j; for(i=-2, j=9; i<=5 ; ++i,j--)…
A: The answer is given below.
Q: What would be the output of the following program
A: Given recursive implementation of hen with 1-9 having base case and more than that will be recursive…
Q: Identify the actual parameters from the code snippets below. float final (int a) return a + 10; }…
A: In programming language, Actual Parameters: Actual parameters are values that are passed to a…
Q: A variable like userNum can store a value like an integer. Extend the given program as indicated. 1.…
A: Given requirement, A variable like userNum can store a value like an integer. Extend the given…
Q: What will be the output when the following code segment is executed? public static void main(String…
A: output will be: before function call a, b, x, y are 3 2 0 5 after…
Q: int main) int a 2: int b-2/0; printf(The value of b is : %d, b): return 0, () Identify bug/bugs in…
A: Error is a fault or flaw in the program code that will halt the program or terminate the program…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Hello, I am struggling with getting this DICE GAME to function properly. I have made an attempt to try and get the overall program to debug and run without errors, but to no avail. If I can get some help getting my PYTHON program to Run Correctly. #Lab 7-3 The Dice Game #add libraries needed playerTwo = 'NO NAME' playerOne = 'NO NAME' inputNames = ("enter name") import random #the main function def main(): print #initialize variables endProgram = "no" playerOne = "NO NAME" playerTwo = "NO NAME" #call to inputNames playerOne, playerTwo = inputNames(playerOne, playerTwo) #while loop to run program again while "endProgram" == 'no': #initialize variables p1number = 0 p2number = 0 winnerName = 'NO NAME' #call to rollDice winnerName = "rollDice"(p1number, p2number, playerOne, playerTwo, winnerName) #call to displayInfo displayInfo: ("winnerName") #end of while loop endProgram = "raw_input"('Do you want to end program?(Enter yes…Modify the below program that the input values representingfractions are stored with denominators that are positive integers. You cannot require the user to only enter a positive denominator value; the user should not be inconvenienced by such a restriction. For example, whilst values of 1 / -2 are acceptable inputs for a fraction, the output representation should be -1 / 2. Your solution should check the denominator input; if it is negative, swap the sign of both numerator and denominator instance variables. //Import the essential package import java.util.ArrayList; import java.util.Scanner; //Define the class Fraction class Fraction { private int n, d; public Fraction() { //Initialize the values this.n = this.d = 0; } public Fraction(int n, int d) { //Initialize the variables this.n = n; this.d = d; } //Define the getter function getNum() that returns the numerator public int getNum() {…Create a program that takes two parameters called base and expo such that b ase is not zero and returns the value of baseexpo . Write a recursive function and call it power.
- QUESTION One of the downsides of using expressions that produce results other than true or false is it is expensive to type-check it hurts readability since it may be confusion to know which route an execution will take. it can cause side effects skewing the results of the rest of the code it hurts writability since we have to write such long expressions.This is a debugging problem that I am completely stuck on. This is the question - 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. This is the code - // DebugFive1 // Adds your lunch bill // Burger and hot dog are $2.59 // Grilled cheese and fish are $1.99 // Fries are 89 cents import java.util.*; public class DebugFive1 { public static void main(String args[]) { Scanner input = new Scanner(System.in); final double HIGH_PRICE = 2.59; final double MED_PRICE = 1.99; final double LOW_PRICE = 0.89; String usersChoiceString; int usersChoice; double bill; System.out.println("Order please\n1 - Burger\n2 - Hotdog" + "\n3 - Grilled cheese\n4 - Fish sandwich"); usersChoiceString = input.next(); usersChoice == Integer.parseInt(usersChoiceString);…One of the downsides of using expressions that produce results other than true or false is it is expensive to type-check it hurts readability since it may be confusion to know which route an execution will take. it can cause side effects skewing the results of the rest of the code it hurts writability since we have to write such long expressions.
- Embed the function in a program and test it. After you have fully debugged this function, define another function named reverseCstring that takes a single argument that is a C string and modifies the argument so that it is reversed. This function will include a call to the recursive definition you did for the first part of this project, and need not be recursive. Embed this second function in a program and test it. Turn in only this final result (with output, of course).Write a program that verifies the delimiters in a line of text or expression typed by theuser. In this case, we will take an arithmetic expression like a*(b+c)+[c/(a-b)]. Yourprogram needs to validate the expression such that opening and closing brackets areproper or not which means the brackets are balanced or not.Can you help me with this program?In C++Write a program that finds all the ways in which the mouse can move to the cheese, and if any, display it with ‘*’.An example diagram of the task is shown in the figure: Operating instructions: Compose a recursive function path (int i, int j), receiving as parameters the coordinates of the current position of the mouse (initially 0.0, and then run with parameters (i-1, j), (i + 1, j), (i, j-1) or (i, j + 1)).
- Rewrite the following code segment using a multiple selection statement in JavaWrite a function in Java. output the following things should be output ask for the members from specific faculty output the top 5 scores members Recommend line up of top members OR members with similar interests list of members over a certain age Use arraylists arraylist name: groupName put explanation aswellThis assignment does not exactly match the one in the textbook on which it is based. I don't want any counter-controlled loops in your solution. Your solution should be able to detect when the accuracy isn't improving and then display the results of the work (as outlined below): Look at Programming Exercise **5.25 in the textbook on approximating the value of π. It is described as: π = 4 ( 1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + ... + (-1)^(i+1)/(2i-1) ) Notice that Java has the best possible value of π that can be stored as a type double available as Math.PI (part of the java.lang package). See how close you can get to the best value of π using a loop with the above technique. Notice that the above implies you are testing the value of your own estimate as it approaches the best value available in Java (as a type double). This would not be a pre-determined, counter-controlled loop. You are testing the results (sentinel-controlled) until you reach a value with the minimum discrepancy…