Given the code: int x, y; cout << "Enter two integers: "; cin >> x >> y; Write a few lines of code that will print all numbers that are factors of x and not factors of y. Example Output 1 Enter two integers: 12 30 4 12 Example Output 2 Enter two integers: 15 24 5 15
Q: Write a function that converts milliseconds to hours, minutes, and seconds using the following…
A: Steps to convert milliseconds to seconds, minutes, and hours as follows Total seconds = Milli…
Q: A palindromic prime is a prime number and also palindromic. For example, 131 is a prime and also a…
A: According to the Question below the Solution: Output:
Q: assign a double variable d to an int variable x, you write ____.
A: This is an explicit type conversion. If we want to assign a value of larger data type to a smaller…
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: Print "user_num1 is negative." if user_num1 is less than 0. End with newline. Assign user_num2 with…
A: error in this line user_num2 == 1 it should be user_num=1
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: Q2:::write a program that computes ,prints and plots A=√X, B-log X; C-In X; D=cx; E-3X; F=X7 Where X…
A: x=1:20 A=sqrt(x) plot(x,A)
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: Write a program that calculates the factorial of a number N, where N is requested from the user.
A: Check the code below.
Q: (1) Prompt the user for an automobile service. Output the user's input. (1 pt) Ex: Enter desired…
A: Following program could be made using if else-if ladder.I used java language as language is not…
Q: Suppose that the input is 0 5 6 4 9 8 –1. What is the output of the following code? (2, 3) Submit…
A: PROGRAM: //Header file #include <iostream> //Using namespace using namespace std; //Defining…
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: ories ( (Age x 0.2757) + (Weight x 0.03295) + (Heart Rate x 1.0781) – 75.4991) x Time / 8.368 te a…
A: CODE : #include<bits/stdc++.h> using namespace std; int main(){ double age; // variable…
Q: C++ In this task, you are required to write a code that converts an Octal number into its…
A: Choice 1 is followed by inserting an Octal integer and getting its Decimal equivalent value as an…
Q: Void Do1 (int: &, a. int &b) { a = 5; a = a + b; b = a + 2; } Int main() {…
A: We have given a C++ code and in which pass variable by reference. Here, integer variable x pass by…
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both…
A:
Q: Write pseudo code that will calculate a running sum. A user will enter numbers that will be added to…
A:
Q: tch (m) {case 0: printf(" the number is low\n"); break; case 1:
A: Code: #include <stdio.h> int main (void) { int m; printf ("enter an integer number between…
Q: Assume int x-5, y-4; int z= (x<4) ? x++: (--x + (2 y++)): What is the value of z? а. n a. n None of…
A: We are given a programming logic question where we are using ternary operator. In ternary operator…
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: int calculatepower (int x, int y){ if (y > 0) return x* else return 1; int main (){ int num, pwr;…
A: Ans is given in next steps
Q: Assume there is a variable, h that has already been assigned a positive integer value. Write the…
A: In step 2, you will get python code. In step 3, you can see the sample output.
Q: Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output…
A: import java.util.*;public class LabProgram { public static void main(String args[]) { Scanner sc =…
Q: Write pseudo code that will count all the even numbers up to a user defined stopping point. (Please…
A: any number which is completely divisble by 2 is even number. So logic is use % (mod) operator and…
Q: C++ Write a program that takes in a line of text as input, and outputs that line of text in…
A: Program approach: Including header files Starting the main function Initializing string variables,…
Q: Write a program that asks the user for three numbers and print the numbers in either ascending or…
A: n1 = float(input("Enter number a: "))n2 = float(input("Enter number b: "))n3 = float(input("Enter…
Q: Write a pseudo code that calculates the total point earned by a football team over a series of games…
A: Pseudocode: Start the program Declare score, i = 0, counter = 0, sum = 0 Get the input scores from…
Q: you have the following statements: int a=2, b=3, c=43; double z=4.5, w=6.7; const float f=8.9%3; The…
A: Answer :
Q: A number in base 2 (binary) is a number such that each of its digits is 0 or 1. To convert from…
A: import java.util.Scanner;public class Main{ public static void main(String args[])…
Q: A prime number is called a Mersenne prime if it can be writtenin the form 2p - 1 for some positive…
A: Program: import java.math.BigInteger; public class Main { public static void main(String[] args)…
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both…
A: NOTE The above question is related to c++ programming and small part of mathematical calculations.…
Q: int input; cout << "enter input " << endl; cin >> input; int…
A: Program: //include the header file #include <iostream> using namespace std; //definition of…
Q: Find out the final values of a,b and c where following expressions are executed sequentially:[4] int…
A: Here in this question we have given a code fragment.and we have asked to find the final value of a…
Q: A number in base 2 (binary) is a number such that each of its digits is 0 or 1. To convert from…
A: Since the programming language is not mentioned, we are providing the answer in Java language.
Q: Problem 7: Guess the price of the car!? You will implement a variant of the number guessing game we…
A: Python used to answer this question
Q: By using Loop in c++, you are responsible to develop a Credit Limit Calculator, which will determine…
A: Find Your Code Below
Q: Suppose n1 and n2 are two int variables that have been given values. Write anif-else statement that…
A: here in this question we have two variable and we have asked to write if else statement it outputs…
Q: Find out what happens in such a case and then modify the program so that negative numbers are…
A: ** you can not reverse -8645 as 5468- if you take the number as an integer. You can do it by taking…
Q: Write a program named TypingGrades that allows a user to enter a student’s number of words typed.…
A: Algorithm: Start READ numWords IF numWords<= 15 then: grade='F'ELSE IF numWords<=30 then:…
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: what is the output of the following code segment? int x = 350; int y = 0; do { y +=x 0; X = x/10; }…
A: Question: what is the output of the following code segment? int x = 350; int y = 0; do { y +=x 0; X…
Q: #include main() { int x = 5; if (x=7) { if (x=7) printf("Hello"); } printf("Hi"); }
A: here is your answer
Q: A number in base 2 (binary) is a number such that each of its digits is 0 or 1. To convert from…
A: code '; def main(): binary = input("Enter a 5 digit binary number: ") #input the binary…
Q: int x, y, z; x-3; int a, b, z; a=l; b-4; y=7; z=9; if(x>y) if(x-y4) while (acb) { a=2*a; b=b+l;…
A: given code on c++ we need to provide the output of the codes, please see the answer in step 2. note:…
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: Given that x = 0, what is the output of this code #include int main (void) { int x; printf…
A: GIVEN: Given that x = 0, what is the output of this code #include <stdio.h> int main (void)…
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: (a) Prompt the user to enter two positive integers n and m (you are not required to handle the case…
A: #include<iostream>#include<math.h>#include<stdlib.h>#include<conio.h>using…
c++ problem
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- 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"); } }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.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"); } }
- int input; cout << "enter input " << endl; cin >> input; int i = input / 2; int d; for (i >= 2; i--;) { d = input % i; if (d == 2 || i == 1) cout << "not prime" << endl; else cout << "prime" << endl; } This code outputs prime numbers as both "prime" and "not prime" but I just want it to say "prime". Please help me with this problem using c++.Suppose j, sum, and num are int variables, and the input is : 25 30 51 3 - 2 What is the output of the following code? int num, j, sum = 0; cout << "Please input five numbers here: "; cin >> num; for (j = 1; j <= 4; j++) { sum = sum + num; cin >> num; } cout << "\nThe sum is: " << sum << endl;1. Write the code to check if y is between 80 and 100 (including 80 and not including 100)? Answer: 2. Given that x = 2, 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"); } } Answer: WRITE C REPL
- int a = 4, b;b = a-- + 2;What is the value of b in the above code? a. 7 b. 6 c. Error d. 5Print "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.What will be printed out as a result of the following code?int x = 5, y = 7;System.out.println(++x);x += y++;System.out.println(x + "," + y); a. 66,8 b. 613,8 c. 513,8 d. 512,7
- 1. Federal law requires that hourly employees be paid “time-and-a-half” for work in excess of 40 hours in a week.For example, if a person’s hourly wage is $12 and he or she works 60 hours in a week, the person’s gross pay shouldbe (40 *12) + (1.5 *12 * (60-40)) = $840.Write a program that requests the floating number of hours a person works in a given week and the person’s hourlywage as input, and then displays the person’s gross pay. Save it as overtimePay.pyFirst, read in an input value for variable inCount. Then, read inCount integers from input and output each integer on a newline after the string "amount=". Ex: If the input is 3 75 70 40, then the output is: amount=75 amount=70 amount=40 1 2 3 4 5 6 7 8 9 10 #include <iostream> using namespace std; int main() { intinCount; /* Your code goes here */ return0; } '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);