Given the code: int x, y; cout << "Enter an integer: "; cin >> x; Write a few lines of code to print "Factor" if x is a factor of y, or "Not a Factor" if x is not a factor of y. This code must always print one of the messages. Example Output Enter an integer: 5 Factor
Q: If you have the following statements: int x; for(x=2; x<11; x++) { } The last value of x after…
A: Here in this question we have given a code segment and we have asked to find the last value of x…
Q: Write a program that asks the user to enter the number of spheres. Then, your program should ask the…
A: i give the code in python as per your requirement and also give the output screenshot as well as the…
Q: Q.5) Write a C++ code that asks the user's name , then the code will ask the user to guess the…
A: #include <iostream>using namespace std;int main(){ //varibale to hold name string name;…
Q: What is the output of the following segment ? int y,x = 1,wW = while ( x <= 5 ) { y = x * x /s; WW…
A: 1) The above code segment calcaute the sum of series(x*x/2) from x =1 to x = 5 1*1/2 + 2*2/2 +…
Q: Given: int num = 0, y = 0, count; for (count=1; count <= 4; count++) { y = y + count; num = num + y;…
A: In a given block of C++ code initial num=0,y=0 First iteration of for-loop i.e count = 1 y = y +…
Q: 3. Write a program that prompts the user for a number and computes the nth term of the following…
A: logic used:- use a infinite loop to repeat till user press y or Y. inside loop, read n. set…
Q: Q1: Write code in VB.NET to solution the following : 8 > x2 + 2Y i=0 If output is positive or less…
A: EXPLANATION Below is the program for the given question. Hope you understand it well. If you have…
Q: Write a program that prompts for an odd integer that is between 50 and 100, inclusive. Use just one…
A: Input the number (say n). Conditions – For the odd numbers: n % 2 != 0 For the numbers equal and…
Q: H.W : Write a program that inputs a five-digit number, separates the number into its individual…
A: //iostream for input output operations #include<iostream> using namespace std;…
Q: لغة اسمبلي 1- Write a program to read a letter in lower case then convert this letter to upper case…
A: 2.
Q: give output #include void main() { int x =3; { x = 4; printf("%d", x); } }
A: A variable declared and initialised within block or function is known as local variable.
Q: program
A: The maximum integer is the maximum number that can be held in binary in an appropriate store. Many…
Q: Assignment 3 Write a complete program that accepts two integer numbers num1 and num2, where num1 <…
A: You didn't specify any language for the problem, so i am doing it in C++ programming Langauge.…
Q: What is output by the code below? hour = 22 if hour > 12: %3D print(hour-12, "O'Clock") else:…
A: given program is hour=22if( hour>12): print(hour-12,"O'clock")else: print("10 o clock")
Q: 14. Write a program to repeatedly allow a user to calculate maximum heart rate estimates, using the…
A: Write a program to repeatedly allow a user to calculate maximum heart rate estimates
Q: 2. Write a console program that reads in an input for value (int) and computes (using mod) if value…
A: We need to read numbers continuously until the user enters a sentinel (0 we choose). The code is…
Q: Write a main function that performs the following: • Prompts user to enter 2 values A and B. ( • If…
A: Find the required code in C++ as language not mentioned given as below and output :
Q: What is the output of the following code when x is equal 5. x CInt(Text1.Text) If x = 1 Then MsgBox…
A: Solution: The correct answer is 'Wednesday' Explanation: In this visual basic program assign the…
Q: First, read in an input value for variable valCount. Then, read valCount integers from input and…
A: I have provided C++ CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOT--------------------
Q: Given x = 3 and y = 1, what value will be assigned to the Double variable w when the following…
A: According to company guidelines only one question can be answered. Kindly repost the other question…
Q: Suppose x, y, z, and w are int variables. What value is assigned to each of these variables after…
A: Let us number the statements as follows: x = 7; y = 2 * x - 3; z = x + y - 3; x = z / y; y = z - x;…
Q: Write a program that prompts the user to input an integer between 0 and 35. If the number is less…
A: code : #include<iostream>using namespace std;int main(){ //input form user…
Q: With the statement, With the statement. int grade-69: if(grade>=70&.&gradec-100) int grade-70;…
A: There is a total of 3 questions asked. 1. There is one c code is given and we have to find its…
Q: Q.4) Write a C++ program for the following flowchart Start 5-0 enter p dividable Isp even? by 37 yes…
A: The algorithm given: Start the loop with s = 0 Ask the user to enter the value of p. Check whether…
Q: PROBLEM: Write a program that prompts the user to input three (3) integers: MM, DD, and YYYY. For…
A: Python program to fid the number of days elapsed
Q: What does the following code output? int x = 7, y = 10; X -= 32; y *= 4; cout « "y = " « y « " and x…
A: In the C++ program, the code that is in the main() function only has provided; so, for the whole…
Q: Enter no. of views for - YouTuber 1: 987 YouTuber 2: 1010 YouTuber 3: 3217 YouTuber 4: 4532…
A: Here I have created an array to store the views entered by the user. Now I have used a for loop to…
Q: What is the output of the following code segment: int a = 12, b = 10; if (a != b && a <b) cout << a…
A: Non of the above
Q: 04 write a program that accepts a day, month and year then calculate the day of year corresponding…
A: I will explain this question in details,
Q: Q4; Write a program to enter a value of x and compute the value of y Where 2(X? + 15) when X >0 Y =…
A: Input : Value of X Output : Value of Y
Q: Given int x=3, y=4; Write a statement to print the addition result of x and y in two lines in a…
A: //statement to print addition result in message boxJOptionPane.showMessageDialog(new…
Q: 4 نقاط This code enters the value of x then calculate the summation of * .the following series s =…
A: Complete program is given below:
Q: PROBLEM: Write a program that prompts the user to input three (3) integers: MM, DD, and YYYY. For…
A: Answer: Algorithms first import inbuilt module form date take input form user like MM,DD,YYYY as in…
Q: use C++ coding Write a RANDOM NUMBER GUESSING GAME – - Hard code a random number as answer - Ask…
A: Given data is shown below: use C++ codingWrite a RANDOM NUMBER GUESSING GAME –- Hard code a random…
Q: 5- What is the output for y? int y = 0; for (int i = 0; i< 10; ++i) y += i; cout << y;
A: The addition assignment operator (+=) : In the addition assignment, the right side operand value is…
Q: (3) Extend to cast the double to an integer, and output that integei6 ,1dt Enter integer: 99 Enter…
A: Code Screenshot :
Q: Write the code to check if y is between 80 and 100 (including 80 and not including 100)? Answer:…
A: Q1. #include<stdio.h> int main() { int y; printf("\nEnter a number :");…
Q: Q.2) Write a C++ code that give the user NUM of chances to guess the letters of a name. If the user…
A: First of all let's understand the algorithm that should follow to solve the problem: 1. Declare a…
Q: Given a line of text as input, output the number of characters excluding spaces, periods,…
A: 1. input a string 2. set the counter to 0 3. now iterate over the string 3.1 if the current…
Q: #What is output when the following code is executed? varx, varY = 12, 20 print (varY) if vary >=…
A: Given:
Q: What is the output of the following code segment? int num cin>>x; = 20, 5, X; if (x >= 2*num) y+=1;…
A: While doing programming in any programming language, you need to use various variables to store…
Q: #include main() { int x = 5; if (x=7) { if (x=7) printf("Hello"); } printf("Hi"); }
A: here is your answer
Q: write a single code line to print the value of an integer variable called H *
A: Code: As no language is specified providing the code in c++ #include <iostream>using namespace…
Q: 6. infave = Given the following code segment, what is the output? int x = 1, y = 1, z = 1; %3D Y - y…
A: Given: x=1, y=1,z=1 y=y+z y=2 x=x+y x=1+2 x=3
Q: What is the output of the following code segment: int x = 9; int y = 1; while (x != 0) { x/= y; x++;…
A: Given data:-
Q: Q.4) Write a C++ program for the following flowchart Start S-0 enter p dividable S =p+ s Is p even?…
A: According to the Question below the program: Output:
Q: 3)Write a program which prompts the user for their age. If they are 19 or younger inform them that…
A: Note- As per our guidelines we are supposed to answer only one question(first) if there are multiple…
Q: Write a program that accepts dates written in numerical form and outputs in complete form. Enter…
A: here in question In this c code, there are 3 variables m, d, and y for storing month, day, and year.…
Q: o Write a program that asks for an integer and reports whether the number is odd or even. Use if ..…
A: The condition for even is Integer must be divisible by 2 The condition for odd is Integer must not…
Q: m=0; do Q/lf m is an integer variable, then when the following code is executed, the print output {…
A: Let us see the answer below,
c++
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- Print "user_num1 is negative." if user_num1 is less than 0. End with newline. Assign user_num2 with 1 if user_num2 is greater than 12. Otherwise, print "user_num2 is less than or equal to 12.". End with newline. My code: user_num1 = int(input())user_num2 = int(input()) if user_num1 < 0: print("user_num1 is negative.") if user_num2 > 12: user_num2 == 1 else: print("user_num2 is less than or equal to 12.") print('user_num2 is', user_num2) When the input is 0 and 13 my output for user_num2 is 13 and it should be 1. I don't know what I'm doing wrong.Write a pseudo code that calculates the total point earned by a football team over a series of games and calculate the average of team. It allow the user to enter the series of game points, As soon as the user enters a negative value -1 to program, it should calculate the average test score and display it. Team A series 1 point: 10Team A series 2 point: 5Team A series 3 point: 8Team A series 4 point: 9Team A series 5 point: 12Team A series 6 point: -1Average of Team A =8.8int y = !(12 < 5 || 3 <= 5 && 3 > x) ? 7 : 9 Based on the code above, what is the value of y if x = 1?
- Write a program that calculates the factorial of a number N, where N is requested from the user.The factorial of a number is: If N=0 or N=1, the factorial is 1If N is any positive number it is calculated asN! = 1 * 2 * 3 * ... * N. For example, factorial of 4 is 1 * 2 * 3 * 4 = 24 If the user enters a negative value, the following message should be displayed:"Undefined factor for negatives"In Chapter 4, you created a program that generates a random number, allows a user to guess it, and displays a message indicating whether the guess is too low, too high, or correct. Now, create a modified program called GuessingGame2 in which the user can continue to enter values until the correct guess is made. After the user guesses correctly, display the number of guesses made. Recall that you can generate a random number whose value is at least min and less than max using the following statements: Random ranNumber = new Random(); int randomNumber; randomNumber = ranNumber.Next(min, max);Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles. 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: 20.0 3.1599 the output is: 3.16 11.85 79.00
- 3)Write a program which prompts the user for their age. If they are 19 or younger inform them that qualify for student discounts. If they are between 20 and 65 inform them that they qualify for no age discounts. If they are 65 or over inform them that they can receive senior discounts. (solution will be Pyhton code,thank you)4)Write a program from decimal to any base, ask the user for a decimal number and convert entered base by user. (Your program should support bases between 2 and 16 .) (solution will be Pyhton code,thank you)Given 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.00Given 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"); } }
- Find out the final values of a,b and c where following expressions are executed sequentially:[4]int a = 2, b =3, c;a = (b++) + (++b) + a;c = a>b ? a:b;b = (a++) + (b--) + a;c = c++*b--;First, read in an input value for variable valCount. Then, read valCount integers from input and output each integer on a newline followed by the string " entries.". Ex: If the input is 3 5 30 15, then the output is: 5 entries. 30 entries. 15 entries. 1 2 3 4 5 6 7 8 9 10 #include <iostream> using namespace std; int main() { intvalCount; /* Your code goes here */ return0; }Given that m = 0, what is the output of this code #include <stdio.h> int main (void) { int m; printf ("enter an integer number between 0 and 5\n"); scanf("%d",&m); switch (m) {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"); } }