:What is the output ;int n = 10 while (n > 0) ;n /= 2 ;cout <
Q: in this code, the integer on each line shows the line number that is not part of code: write line…
A: public static int sum(int x, int y){ int z = x +y;//adds both input parameters and stores result in…
Q: QI B// find the error and type and then bulid ST ? #include "iostream" void main() { const…
A: let us see the answer:-
Q: .look at code below then fill the blanks ;int a = 5, b = 2, C = 6, d = 4 if (!b) %3D "cout d)…
A: Here in this question we have given a c++ code..and we have asked the output of the program.
Q: 1. Write a program that will find the Smallest, Largest and Average value in a collection of N…
A: As no language is mentioned I am solving this using C. #include <stdio.h>int main(){ int…
Q: plete the whole code a..
A: The code is below:
Q: The output of this program is:#include int main (){int n ;for (n=10; n>O; n--) cout <<n << ", "…
A: Solution :
Q: #include using namespace std; int main() { char line; cout << "Enter a string: "; cin.get…
A: cin.get() is used to access array elements. White spaces are also taken into count. normally…
Q: need help urgent
A: The program starts by asking the user to enter a number n. sqrt() function in "math.h" library is…
Q: int num; scanf("%d", &num); int n1; int pid = -1; for (int i=0; i<2; i++) { if(pid) { n1 = num%10;…
A: The above code is written in C language. when input is specified as integer type then it only…
Q: 7. Write pseudo code that will calculate a running sum. A user will enter numbers that will be added…
A: //Read an integerN = INPUT()//Variable to store running sumRUNNING_SUM = 0//Check if number is…
Q: int mycount=0; int p-30; while(mycount<p) { printf("%d",p%3); P-p/2; mycount++; }
A: c- 3 is the right answer and output -0 0 1
Q: 5. A positive whole number n > 2 is prime if no number between 2 and n (inclusive) evenly divides n.…
A: Introduction : Here we have to write a program that accepts a value of n as input and determines if…
Q: nput a value for the variable y so that the variable x becomes 4 after the code executes.…
A: According to the Question below the Solution:
Q: Consider records of employees each consists of employee's first name (string), number of hours…
A: I give the code in python along with output and code screenshot
Q: def moo (n): if 8. return 1 else : return moo ( )+ 2 print (moo (0)) print (moo (1)) print (moo (2))…
A: Logic: Above program is recursive program. recursion done until execute a base condition. if we pass…
Q: b. void counting (int n) { if (n < 0) return; else { } } std::cout << n << std::endl; counting…
A:
Q: Guess number game. Write a program in Java to: a. Generate a random integer between 1 and 100…
A: In Java, random() method is used to generate random numbers. Syntax to Generate Random Number…
Q: printMultTable(int, int);
A: //Explanation for the printMultTable(int,int) ->Here int printMultTable(int,int) is a function…
Q: char get (char x,int y, double z){ x static cast( y + ceil (z)); return X; What is the output of the…
A: get method have different implementations with varied parameters and this concept is known as method…
Q: Find the output: int i - 1: while (ii<- 10) { cout <<i<<: i +-2; } cout << endl;
A: The answer is as follows
Q: 4.15 LAB: Hailstone sequence Given a positive integer n, the following rules will always create a…
A: Ans: Code: n = int(input())print(n, end='\n')while n > 1: if n % 2 == 0: n = n//2…
Q: Compute: z = y/Va 1 include 2 #include 3 #include 4 #include 5 using namespace std; 7 int main()…
A: Algorithm : Step 1 : declare the double variables x, y and z. Step 2 : take the input of x. Step 3…
Q: baython you have the following code, .choose the correct answer x = [3.0, 5.0, -1.0, 0.0, 3.14] n =…
A: x and n both are variables where x is storing the reference of the list and n is storing the length…
Q: 4.15 LAB: Hailstone sequence Given a positive integer n, the following rules will always create a…
A: Python is one of the most popular programming language.And it is oops and high level programming…
Q: Write a program that prompts the user to enter a set of integer numbers, and finally displays the…
A: Program Approach : Include necessary libraries. Define array , index variables . Ask the user to…
Q: int mystery (int u, int v) { int a; a = u - V; u = a; V = u; return u + v; choose the output of the…
A: From. The given function mystery(9,7) int u = 9 And int v = 7 Now a = u-v a= 9-7 a= 2 Now u= a
Q: 4.15 LAB: Hailstone sequence Given a positive integer n, the following rules will always create a…
A: Complete Code in C with explanation in the comment: #include <stdio.h> int main() {…
Q: Compute: z = V[x] – y 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 int…
A: In the above program, we have to compute the value of z.Here We have used setprecision which is used…
Q: 3- How many the number of erTors in the following sub_ program? Hinclude void main( ) intnum, sum -…
A: the answer is option d 7
Q: int input; cout << "enter input " << endl; cin >> input; int…
A: Program: //include the header file #include <iostream> using namespace std; //definition of…
Q: int t = 7; int s = 17; if (t > 6) { s t= 5; } else { s -= 2; } D-2 D 5 O 22 D 17
A: 1) the expression should include 98 and 101, but anything lower or higher should sound an alarm.…
Q: Find the output #include void main () { int a=3,b32,c%3Da*b; b++; a=b++; b++;…
A: INTRO Find the output #include<iostream.h> void main () { int a=3,b32,c%3Da*b; b++; a=b++;…
Q: int x = 5, y = 2, z = 3; if ( x z) cout 2 ) { cout << z <<" "<< y-x << endl; cout << z * (x + y)<<…
A: The program is written in C++ Language. Please find the source code and output in the below steps
Q: int func (int a, int b, int c){ if (a<=c) return 4; else if (a<b) return 8 else return a+c
A: Converting c code to RISC -V is a hectic task , but the function provided here is a bit easy, we…
Q: Use following main function to test your program. (have to use this main function) int main() { cout…
A: Program Approach:- 1. Include header file 2. Create the class whose name is RatNum 3. Create two…
Q: 7) #include int fun(int n) 11 { 20 if(n==0) return 5; return n+fun(n-1); } main() { printf("%d\n",…
A: In this question, we need to explain the code. The function uses the concept of recursion.
Q: #include main() { int x = 5; if (x=7) { if (x=7) printf("Hello"); } printf("Hi"); }
A: here is your answer
Q: int funcB (int) : int funcA (int n) { if (n 5) ( return n * funcA (n 9) : else ( return n + funcA…
A: The given code: #include <iostream>using namespace std; int funcB(int);int funcA(int n){…
Q: What will be displayed by test(3); ? void test( int n) if (n1) cout << "**". else test( n - 1); cout…
A: Recursive call: test(n-1); It perform calling repeatedly until base case is executed. Here…
Q: A B C 1 2 3 4 15 6 T H E T E S s b 10 11 12 13 14 15 16 17 18 19 10 T R 0 G RAM Given:name = Billage…
A: The following solutions are:
Q: What does the following code segment output? int x= 5; for ( ; ; x++) { if (x < 6) cout<< x << " ";…
A: B. 5
Q: The special case return value that will terminate the following code i
A: The special case return value that will terminate the following code is ____________________. int…
Q: int a=3, b=5, c=7, d=-2; if (d > 0) cout << a + b *c << endl; else cout << a * b -c<< endl; A -13 B…
A: This question of condition checking or conditional checking. So, let's just talk about this…
Q: I (Assign grades) Write a program that reads a list of scores and then assigns grades based on the…
A: class grade_calculator: def __init__(self): self.__marks_obtained = []…
Q: Q/Write a program that reads from the user a set of numbers, and first, it has to check how many…
A: Note: Since no programming language is mentioned. I am attempting this in python. if you need it in…
Q: 3. Complete the function count_digits. This function takes one parameter - a string (s). It should…
A: Note: We are allowed to answer one question at a time, according to the BNED Guidelines. For the…
Q: #include int *get( ) int y = 10; int *x = malloc ( return y;
A:
Q: nsider: lic static void printAll(int[] a) { N = a.length;
A:
Q: The Mastermind game board game is a code breaking game with two players. One player (your program)…
A: import randomsecretCode =[]for i in range (0,4): n = random.randint(1,9)…
Step by step
Solved in 2 steps
- Guess number game. Write a program in Java to: a. Generate a random integer between 1 and 100 (inclusive) and prompt user to guess the number. b. If the guess is not right, give the user the hint like “higher”, “lower”. Allow the user to retry and input the new guess. c. Likely you want to use a while loop to support the user’s multiple attempts. Stop the loop when the user guessed the number. d. Print out the number of attempts for the user for this round of game..c## Write a Console Application that reads two integers, determines whether the first is a multiple of the second and displays the result. [Hint: Use the remainder operator.]If the new operator cannot allocate the amount of memory requested, it throws_____________
- What will happen when the following code is executed?def SubtractMe(x): k = x - (2/0) if (k <= 6): return 6 else: return kSubtractMe(9)Nice Number Programming: Nice program ask user to enter three integers from keyboard (java console), the three integers represent left bound, right bound and arbitrary digit 'm', where left bound is less than right bound. Program should print all nice numbers in the given range that doesn't contain digit 'm'. The number is nice if its every digit is larger than the sum of digits which are on the right side of that digit. For example 741 is a nice number since 4> 1, and 7> 4+1. with digit m=2. Write a complete program in Java that Call only One method (niceNumbers method) that will print all nice numbers excluding a given digit 'm' that also entered by user?Number guessing Game Write a C program that implements the “guess my number” game. The computer chooses a random number using the following random generator function srand(time(NULL)); int r = rand() % 100 + 1; that creates a random number between 1 and 100 and puts it in the variable r. (Note that you have to include <time.h>) Then it asks the user to make a guess. Each time the user makes a guess, the program tells the user if the entered number is larger or smaller than its number. The user then keeps guessing till he/she finds the number. If the user doesn’t find the number after 10 guesses, a proper game over message will be shown and the actual guess is revealed. If the user makes a correct guess in its allowed 10 guesses, then a proper message will be shown and the number of guesses the user made to get the correct answer is also printed. After each correct guess or game over, the user decides to play again or quit and based on the user choice, the computer will make…
- Following code is for 4×4 tic toc toe game covert this code in to 3×3 players. Code #include <iostream> using namespace std; class Board { char board[4][4]; public: Board() { for(int i=0;i<4;i++) { for(int j=0;j<4;j++) { board[i][j]='_'; } } } void printBoard() { for(int i=0;i<4;i++) { for(int j=0;j<4;j++) { cout<<board[i][j]<<'|'; } cout<<endl; } cout<<endl; } int setPosition(char choice) { while(1) { int row,column; cout<<"Please enter the row and column"<<endl; cin>>row>>column; if(board[row][column]=='_') { board[row][column]=choice; break; } else { cout<<"Position is taken"<<endl; } } } char getPosition() { for(int i=0;i<4;i++) { for(int j=0;j<4;j++) { return board[i][j]; } } } int checkHorizontal(char choice) { int count; for(int i=0;i<4;i++) {…Method: sumOdds(value: int): This method will sum all the odd values from 1 upto the value passed by parameter. This will display the sumas an integer value.Method: characterCount(phrase: str): This method will count the number of characters in the phrase that is passed by parameter. You cannot useany built in function ( ie len() ) and must use a looping activity. This should display the number of characters inthe phrase as an integerMethod: multiplicationPractice(): This method is to practice simple multiplication problems. The program should randomly generate twonumbers from 1-10 for the user to multiply. It should display the multiplication problem and allow the user toanswer the problem. It should display if the user got the answer correct or incorrect. The activity shouldcontinue until the user has gotten 3 different practice problems correct.Method: order(value1: int, value2: int, value3: int): This method is to order the 3 passed value from least to greatest. It should display…Health application: BMI) Revise Listing 3.4, ComputeAndInterpretBMI.java, to let the user enter weight, feet, and inches. For example, if a person is 5 feet and 10 inches, you will enter 5 for feet and 10 for inches. Here is a sample run: Enter weight in pounds: 140 Enter feet: 5 Enter inches: 10 BMI is 20.087702275404553
- int fun(int k){ return ( ); void main(){ int n; cin >> n; n = n * fun(n); <-- 1 Fill in the appropriate statement and expression in fun, so that when it is called in main, and after the execution of the statement marked 1, the value of n would always be n3.Order check Write a program OrderCheck.java that takes four int command-line arguments w, x, y, and z. Define a boolean variable whose value is true if the four values are either in strictly ascending order (w < x < y < z) or strictly descending order (w > x > y > z), and false otherwise. Then, display the boolean variable value.#include <stdio.h> struct Single { int num; }; void printSingle(int f) { int binaryNum[33]; int i = 0; while(f>0) { binaryNum[i] = f % 2; f = f/2; i++; } for (int j=i-1; j>= 0; j--) { printf("%d",binaryNum[j]); } } int main() { struct Single single; single.num = 33; printf("Number: %d\n",single.num); printSingle(single.num); return 0; }