What will be the output of the program given below? #include int main () { int a = -10, b 20; if(a > 0 & & b <0) %3D %3D a++; else if(a < 0 && b < 0) a--; else if(a < 0 && b > 0) b--; else b--; printf("%d\n", a + b); return 0; Output:
Q: C Languagge: 1. What will be printed from the following program segments? (5 points each) a. for…
A: THIS IS A MULTIPLE QUESTION BASED PROBLEM. ONLY FIRST QUESTION IS SOLVED. KINDLY SEND THE REMAINING…
Q: Modify the program below to display the output at the center of the screen using escape specifiers.…
A: \t is the escape specifier used in the program. #include <stdio.h>#include <stdlib.h>int…
Q: #include int main() { printf("********Welcome My Students***********\n"); printf("2…
A: The outputs are given in step 2.
Q: Show manual tracing for the following program and find the final output. In the program,…
A: The program given is: #include<stdio.h>int a, b;int func1(float x);void func2(int x, float y);…
Q: Which expressions for YYY and ZZZ correctly output the indicated ranges? Assume int x's value will…
A: Given: if(YYY){// Output "0-29"}else if (ZZZ) {// Output "30-39"}else {// Output "40+"}
Q: 8 Write a python program that will produce Bowditch or Lissajous figures (x(t) vs y(t)) o (x(t) =…
A: Code: from numpy import sin,cos,pi,linspacefrom pylab import plot,show,subplotimport…
Q: Suppose that x and y are of type int, z is of type double, and ch is of type char. Consider the…
A: Given:
Q: Q13)What are the output of the following program? #include int main() {…
A: Question 13: The code below has 2 print lines, one is just a basic print line, which prints the…
Q: Using the sequence programming concept, create a java program that will read three resistors,…
A: Java Program for Above : import java.util.Scanner; class Prog{ public static void main…
Q: What will be printed by code below? Explain the output. 1 // Program 5(b) 2 3 #include 4 5 int main…
A: The answer is given below.
Q: Consider the following program in which the statements are in the incorrect order. Rearrange the…
A: C++ used to answer this question
Q: Write a program whose input is two integers, and whose output is the first integer and subsequent…
A: //Declare variables integer firstinteger second//Get first valuefirst = Get next input//Get second…
Q: Write a java code for below requirements Input: A = 30, B = 100, M = 30 %3D Output: 3 Explanation…
A: The Answer is
Q: Using the sequence programming concept, create a java program that will read three resistors,…
A: Import required libraries. Declare the main() function. Prompt user to input the value of resistor1.…
Q: Write a program that declares a variable that represents the minutes worked on a and assign a value.…
A: import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner…
Q: What is the output of the following program: #include using namespace std; void Push(int x[], int…
A: Initially, array A is having only one value {0} After executing the for loop, array A will now have…
Q: * (Practice) Show the output of the following statements. a) System.out.printf("amount is %f %e\n",…
A: the above codes are executed and screenshots are attached with the answer below:
Q: In this task, you are required to write a code which takes as an input an angle [0°, 90°] in radians…
A: Step 1 : Start Step 2 : In the main function , Take user input for the value of the angle in radians…
Q: What is the output of the following code when embedded in a complete C++ int secret (int x) { } int…
A: #include <iostream>using namespace std;int secret(int x) // function prototype{ int i=2*x,…
Q: What will be the output of the following program? #include void main () { int a[10] =…
A: Step 1 The answer is given in the below step
Q: 20. What is the output of the following Java code ? int a=3, b=-3, c=0; if (a >= c){ if (b != -3)…
A: The program declares three variables a, b, c with values 3, -3, 0 respectively. First conditional…
Q: What is the output of the following program if no error? class A { void sum(int x, int y){…
A: i give this question answer in next step
Q: Write a complete program that will read two integer values. Your program should compute and display…
A: as you have not specify any language so I give the code in Python along with outout and code…
Q: The following program contained error. Fixed the error, run and write the output generated after…
A: Code is given below #include <stdio.h> double method(int x, int y) { return (double)(x +…
Q: Consider the following program: int f(int x, int y); int a = 4; int b = 2; int main(void){ int c= a…
A: The problem is based on finding the output of the given code snippet.
Q: 2.1) What is the output of the following program? Winalude int print x (int x) if (0) ( print…
A: The output of the above code (c code )
Q: 2. What will be the output of the following Turbo C program? Write your answer in the box provided.…
A: We are given a C code and we are going to trace the code and will show what is the output of the…
Q: def aaa(p): return p ** 3 print("more defs". def bbb(q): return q // 16 def ccc(p, q): print(aaa(p))…
A: I have given justication of this code below in detail.
Q: In this python program, convert into java program please. Thank you Source Code: print("The…
A: print("The function is f(x)= 2x+3(2)")print("Width is 0.05")lowLim=float(input("Enter Lower Limit:…
Q: Consider the code presented below. What is/are the line(s) that will never be executed, for any…
A:
Q: Q3. a) Write a program to find the resultant (R) of two forces F1 & F2 with angle 0 between them as:…
A:
Q: Write a javascriet Program for below requirements Input: A = 50, B 100, M = 90 %3D Output: 1…
A: code for the above question is given below:
Q: Write a Java program to give the user the ability to enter an integer of 4 digits. Assume the value…
A: /* package codechef; // don't place package name! */ import java.util.*;import java.lang.*;import…
Q: What is the output of this program? #include int MAX (int a, int b) { if (a > b) return a; else…
A: To find the output of the given program. The given program is: #include<studio.h>int MAX…
Q: Write a program whose input is two integers. Output the first integer and subsequent increments of 5…
A: Please Indent the code as shown in the picture below :
Q: What will be the output of the below program: x=6 y=2 z=x*y
A: As per code syntax , it is written in python language.
Q: Considering the following declarations Q? а, b, с, d; double w, х, у ,2; int a=10 ; b=5 ; c=1 ; d=2…
A: #include <stdio.h> int main(){ int a,b,c,d; double w,x,y,z; a=10; b=5; c=1;…
Q: Write a program that will compute the sales tax on a $352 purchase. Assume the state sales tax is…
A:
Q: JAVA CODE OF THIS: In a triangle, the sum of the 1st and 2nd side must always be greater than the…
A: As given, I need to write a Java program that takes input of 3 positive integers of as 3 sides of…
Q: Write a program that simulates flipping a coin to make decisions. The input is how many decisions…
A: PROGRAM: //Importing the required header files #include<iostream> #include<cstdlib>…
Q: In this python program please put the final answer/Summation of all iterations is 0.95 and please…
A: We want to print a summation of all answers. But in the question the sum is given as 0.95 which is…
Q: Write a program that inputs values of type char, short, int, & long the values in union variables of…
A: the code is as follows:-
Q: we have the java programe that calculate x,y,vy,vx every 10ms assume velocity and angle is input by…
A: time= time+ 0.01 icreases the time by 10 milliseconds And the System.out.print statements gets…
Q: Will the following program execute successfully? If not, state the reason(s): (i) #include (ii) void…
A: For both parts , I have provided answer---- For each part , I have provided error if occurred…
Q: 3. What is the screen output of the following program? Write your answer in the box provided.…
A: As your your question is about writing output of your code. so let's see output of the code on the…
Q: We want to code an example of compound interest. Prompt the user to input a starting balance and an…
A: Start Read Principal Read interest rate calculate amount using computing balance at each step…
Q: What is the output of the following code? int x - 0; if (x > 4) { x - 1; else if (x < -4) { x - -1;…
A: Answer: x is 0
Q: What is the output of the following program? #include int main (void) { int x = 0; for (int i = 0;…
A: A file having an extension .h file is a header file that includes declarations of functions and…
Step by step
Solved in 2 steps with 2 images
- in java First, read the first floating-point number from input. Then, read the remaining floating-point numbers while the floating-point numbers are in the range -20.0 to 20.0, both exclusive. Output the total number of floating-point numbers read in the given range. End with a newline. Ex: If the input is -14.0 -26.5 -13.0 -17.5 -18.0 -16.5 -12.5 -15.0, then the output is: Number of floating-point numbers read: 1 Note: -20.0 and 20.0 are not in the given range. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 import java.util.Scanner; public class CountRead { publicstaticvoidmain(String[] args) { Scannerscnr=newScanner(System.in); doubleinputData; intcountRead; countRead=0; /* Your code goes here */ } }How do I solve this problem in java programming language? After all loan information is input, the program should output the loans in the following format: Sanchez Construction Loan #1 Name: Joe $10000.0 for 5 year(s) at 9% interest Loan #2 Name: Sara $5000.0 for 3 year(s) at 10% interest Loan #3 Name: Mike $975.0 for 1 year(s) at 10% interest Loan #4 Name: Jane $7000.0 for 5 year(s) at 9% interest Loan #5 Name: Peter $300.0 for 1 year(s) at 9% interestWrite a program that simulates flipping a coin to make decisions. The input is how many decisions are needed, and the output is either heads or tails. Assume the input is a value greater than 0. Ex: If the input is: 3 the output is: headstailsheads For reproducibility needed for auto-grading, seed the program with a value of 2. In a real program, you would seed with the current time. In that case, every program's output would be different, which is what is desired but can't be auto-graded. Note: A common student mistake is to call srand() before each call to rand(). But seeding should only be done once, at the start of the program, after which rand() can be called any number of times. Your program must define and call the following function that randomly picks 0 or 1 and returns "heads" or "tails". Assume the value 0 represents "heads" and 1 represents "tails".string HeadsOrTails() #include <iostream>#include <cstdlib>using namespace std; /* Define your function here */…
- Write a program that calculates the reactions of a cantilever bearing a triangular bearing, taking into account different arrangements of the bearing, and displays a simplified form of the cantilever.1) Replace (????) with relevant code for the program to function. Details of the code have been given below. (Java has been used) Show your output. This program should display: 2 -2 3 16 13 11 10 0 -10 */ package finalexamtakehome5; public class Finalexamtakehome5 { // public static void the(int x, int y) { while (x > 0 | y > 0) { x = x - y; y--; System.out.print(x + " "); } System.out.println(y); } // public static void main(String[] args) { theWhile(????); theWhile(20, 4); theWhile(40, -10, 7, 9); } }I want a solution in Java, please!! Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Done", "done", or "d" for the line of text. Ex: If the input is: Hello there Hey done the output is: ereht olleH yeH
- Write a program with total change amount in pennies as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. Ex: If the input is: 0 the output is: No change Ex: If the input is: 45 the output is: 1 Quarter 2 DimesI need to write a Java program that takes the names and grades of students and outputs their name, the letter grade, and the Z grade. For this program the letter grade is determined by the following cut-offs: A>=1.0, 1.0 > B>=0.0, 0.0 > C>=-1.0, -1.0 > D>=-2.0, -2.0 > F The z-score depends on the mean and the standard deviation. It is calculated by subtracting the population mean from an individual raw score and then dividing the difference by the population standard deviation. The student letter grade for the assignment is based on how many standard deviations away from the mean that student number grade is. Sample input and output is shown in the picture.Write a program that simulates flipping a coin to make decisions. The input is how many decisions are needed, and the output is either heads or tails. Assume the input is a value greater than 0. Ex: If the input is: 3 the output is: heads tails heads For reproducibility needed for auto-grading, seed the program with a value of 2. In a real program, you would seed with the current time. In that case, every program's output would be different, which is what is desired but can't be auto-graded. Note: A common student mistake is to call srand() before each call to rand(). But seeding should only be done once, at the start of the program, after which rand() can be called any number of times. Your program must define and call the following function that returns "heads" or "tails".string HeadsOrTails() #include <iostream>#include <cstdlib>using namespace std; /* Define your function here */ int main() {// Add more variables as neededsrand(2); // Unique seed /* Type your code here…
- I need to write a java program that reads in a month from the keyboard, as a String (i.e., January), and determines and outputs the number of days in that month based on the table below: January 31 February 28 March 31 April 30 May 31 June 30 July 31 August 31 September 30 October 31 November 30 December 31Write a program that simulates flipping a coin to make decisions. The input is how many decisions are needed, and the output is either heads or tails. Assume the input is a value greater than 0. Ex: If the input is: 3 the output is: heads heads tails For reproducibility needed for auto-grading, seed the program with a value of 1. In a real program, you would seed with the current time. In that case, every program's output would be different, which is what is desired but can't be auto-graded. Note: A common student mistake is to seed before each call to random.randint(). But seeding should only be done once, at the start of the program, after which random.randint() can be called any number of times. Your program must define and call the heads_or_tails() function that randomly picks 0 or 1 and returns "heads" or "tails". Assume the value 0 represents "heads" and 1 represents "tails". this is what i have import random def heads_or_tails(n): i=0 while i<n: num = random.randint(0,1)…Write a program that simulates flipping a coin to make decisions. The input is how many decisions are needed, and the output is either heads or tails. Assume the input is a value greater than 0. Ex: If the input is: 3 the output is: heads heads tails For reproducibility needed for auto-grading, seed the program with a value of 1. In a real program, you would seed with the current time. In that case, every program's output would be different, which is what is desired but can't be auto-graded. Note: A common student mistake is to seed before each call to random.randint(). But seeding should only be done once, at the start of the program, after which random.randint() can be called any number of times. Your program must define and call the heads_or_tails() function that randomly picks 0 or 1 and returns "heads" or "tails". Assume the value 0 represents "heads" and 1 represents "tails". python import random def heads_or_tails(): # Type your code here. if __name__ == '__main__':…