what is the output of the below programs
Set Number1 = 1
2. Set Number2 = 2
3. Set Number3 = 3
4. Set value of Sum = Number1+Number2+Number3
5. while (sum <= 39)
Number1 = Number2
Number2 = Number3
Number3 = Sum
Sum = Number1+Number2+Number3
output “*”
6. end of while loop
7. output “Number1 is :”, output Number1
8. output “Number2 is:”, output Number2
9. output “Number3 is:”, output Number3
10. output “Sum is:”, output Sum
what is the output of the below program
START
Number1 = 1
Number2 = 30
Sum = 0
while (Number2 >= Number1)
Number1 = Number1 + 1
Number2 = Number2 – 2
Sum = Number1 + Number2
end while loop
output “Number1 is :”, output Number1
output “Number2 is:”, output Number2
output “Sum is”, output Sum
End
write pseudocode using only while
te Code:
To Print Triangle of any size, by taking size as input. If size is
4 then triangle is:
To calculate Factorial of any number.
To calculate the power of any given number.
To Print Table of Any Number up till 10: as shown in this
figure.
for a program which reads 10 integers from the user, and output the
largest value
from input numbers.
Note Use only while loop
Answer to the first question
is:
The while loop goes on iterating until the condition becomes false, that is, until sum value is less than or equal to 39. When sum value is greater than 39, control comes out of while loop and the remaining output statements are executed.
The explanation is given in the image.
what is the output of the below programs Set Number1 = 1 2. Set Number2 =...
MATLAB QUESTION
function Huge_Add = huge_add(number1,number2)
sum= number1 + number2;
sprintf(' %+5.2d',sum)
end
3. Write function called huge add that adds together two positive integers of any length specified as strings using decimal notation. The single output argument is the result and it is a string as well. The inputs and output must contain digits only; no commas, spaces or any other characters are allowed. If any of these assumptions are violated by the input, the function returns the number-1.
// 2. Practice debugging this program. It has approximately 22 compiler errors, 1 logic error and //1 usability error. Identify them all. import java.util.scanner; //This program finds the average of three input values. public class Arithmeticx { public static void main( String [] args ) // declare variables double number1, number2, number3; // input data scanner in = newscanner( ); System.out.print( "Number 1? " ); System.out.print( "Number 2? " ); System.out.print( "Number 3? " ); number 1 = in.nextDouble; number...
Debug the following java code so that it will have given out put at the bottom. Make sure to fix all syntax and logical errors. import java.util.Scanner; public class Graphs { // draws 5 histograms public void drawHistograms() Scanner input = new Scanner( System.in ); int number1 = 0; // first number int number2 = 0; // second number int number3 = 0; // third number int number4 = 0; // fourth number int number5 = 0; // fifth number...
4.25 Lab9d: Factorials This program will output the factorial of numbers 1 through 10. Recall that 10! = 10 * 9 * 8 * 7 * … * 2 * 1. Calculating the factorial will require two loops. The outer loop will iterate from the number 1 up to and including the number n. n will be based on a number the user entered (an int value). The inner loop will calculate the factorial of the number the first loop...
// Group Names: // Date: // Program Description: // Import required packages //--> // Declare class (SwitchDoLab) //--> { // Declare the main method //--> { // Declare Constant integers SUM = 1, FACTORIAL = 2, QUIT = 3. //--> //--> //--> // Create an integer variable named choice to store user's option. //--> // Create a Scanner object // Create...
2. What is the output of the following code fragment? n = 1; while (n <= 5) { n++; cout << n << ' '; a.1 2 3 4 5 b. 1 2 3 4 c. 1 1 1 forever d. 2 3 4 5 e. 2 3 4 5 6 3. What is the termination condition for the following While loop? while (beta > 0 && beta < 10) { cout << beta << endl; cin >> beta; }...
Please help code in c++ and use the answers you get from question 1
and 2 into the 3rd answer! Question 1 is first, question 2 is in
the middle, question 3 is last
Input Array (10 pts) te a function only (no main) that takes an array of doubles as a parameter as well as another integer rray. Create a for loop that asks the user to input any real number between-100 and r each element of the array....
The following individual two programs are using while loop in order to print a specific output: The outputs of the first program are: 10 9 8 5 4 The outputs of the second program are: 123456789 Using the Table 3.1 below, allocate the error(s) of each line of two programs and type of error: The first program: public Main { public static void main(String args[]){ int i=10 while(i>4){ System.out.print(i); i++; } } } The second program: public class Main {...
The following individual two programs are using while loop in order to print a specific output: The outputs of the first program are: 10 9 8 5 4 The outputs of the second program are: 123456789 Using the Table 3.1 below, allocate the error(s) of each line of two programs and type of error: The first program: public Main { public static void main(String args[]){ int i=10 while(i>4){ System.out.print(i); i++; } } } The second program: public class Main {...
What does the following nested loop structure output? count = 1; while (count <= 11) {innerCount = 1 while (innerCount <= (12 - count)/2) {cout << " "; innerCount++;} innerCount = 1; while (innerCount = 1; while (innerCount <= count) {cout << "0"; innerCount++;} cout << endl; count++;} What does the following nested loop structure output? count = 1; while (count <= 10) {innerCount = 1; while (innerCount <= 10) {cout << setw(5) << count * innerCount; innerCount++;} cout <<...