Choose the correct answer int a = 11, b = 22, c = 33, d=103; %3D d = d - ((a * a +b - c) + (C - a) * b); if (d < a) Console.WriteLine("The value of D is less than A"); else Console WriteLine( The value of D is greater than A"); Select one: O The value of D is less than A O The value of D is greater than A O Program Error O No output
Q: Write a program that will determine if a number is positive or negative. If positive it should be…
A: Given: Write a program that will determine if a number is positive or negative. If positive it…
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: What would be output to the screen after the following code is executed: int num1 = 10; int num2 =…
A:
Q: Using Python: Write a program which repeatedly reads numbers until the user enters “done”. Once…
A: The total will be used to give the sum of numbers entered, the count will give the number of values…
Q: Write a program that generates a random number in the range of 1 through 100, and asks the user to…
A: ## As no language is mentioned here, we write the program in Python language. # importing…
Q: Given the following code, what is the final value of x? int x=1, y=2, z=3; bool w=true; x=w=y-z;
A: #include <iostream> #include <string> using namespace std; intmain(void) { int x = 1,…
Q: A factorial of N is defined as 1 if N is O or 1, and 1*2**N if N is a non-negative integer. Write a…
A: note:- only one program will be solved if they are not linked . Also mention programming language…
Q: How do I fix the error in the code? Error: Error ---------- Movie.toString() returns: Movie: […
A: code is given below:
Q: Write a program using C++ language that prompts the user to input an integer between 0 and 35. The…
A: Input a number. IF number < 9 ,print the no. else provide the output acc. to asked in the…
Q: The output of the following code snippet is: int main() { char a='P'; printf("Value of a is %c",a);…
A: int main() { char a='P'; printf("Value of a is %c",a); }
Q: 4. Write a RANDOM NUMBER GUESSING GAME - • Hard code a random number as answer • Ask user for input…
A: CODE:- #include <iostream> using namespace std; int main() { int…
Q: Write a program that prompts the user to enter a nonnegative integer and outputs the factorial of…
A: #include<iostream> using namespace std; int main(){ int number; cout << "Enter a…
Q: Consider the following lines of code: int test1 = 83; int test2 = 90; double average = (test2 +…
A: The answer for this "No"
Q: Question Completion Status: def printing(pattern, number): for i in range(number): print ("**")…
A: According to the Question below the Solution: Output:
Q: 2: Choose the right answer for the following: string x; What is the output for the following code?…
A: Introduction:- String can't take complete input after whitespace. + is used to concatenate if both…
Q: What will be the value of the variable x after the execution of the program? %#3include int main()…
A: Ans : The value of the variable x after execution of the program is : int main(){ int x; x…
Q: nt x=10; if(x++ >10) { x =13; }
A: Given: int x=10; if(x++ >10) { x =13; }
Q: What is the output of the following code segment? def pass_it(x, y): z = x**y return(z) num1 = 3…
A: Answer is 81 Explanation: z=x**y means x to the power y function is x to the power of y 3 to the…
Q: Your relative, who goes to primary school and has just learned the multiplication table, asks you to…
A: using System; public class Multiplication { public static void main() { int i,n,count=0;…
Q: Write a program that converts U.S. dollars toCanadian dollars, German marks, and British pounds, as…
A: Program: import java.text.NumberFormat; import java.util.Locale; import…
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both…
A: Program code: //include the required header file #include <iostream> #include…
Q: What is the value of num3 after the following code is executed: int num1 = 5; int num2 = num1 * 3;…
A: We need to find the output of the given code.
Q: What is the output of the following code segment? int x = 5; if (x = 2) cout << "This is true!" <<…
A: The given code is : int x=5; if(x=2) cout<< "This is true" << endl; else…
Q: Enter student mark : mark If 70>Mark >60 mark = mark + 3 If 80> mark >70 mark = mark+4 C# If 90>…
A: Objective: A program should be constructed from the given pseudocode. It reads the mark of a student…
Q: How many times will the output line be printed in the following code snippet? Please enter your…
A: How many times output line be printed. for(int j=1;j<4;j++) { for(int k=0;k<=3;k++)…
Q: The value of a will become 3: int x = 2; x++; int a = (!5 == 5 + 2) ? 3>x ? 3: 5 : 4; cout << x;…
A: 1) In Above code segement we are using multiple conditions in Ternary Operator (?:) 2) We have two…
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: What will be the output of the program? void fun(int n){ if(n > 0) { fun(n-1); printf("%d ", n);…
A: void fun(int n) { if(n > 0) { fun(n-1); printf("%d ", n); fun(n-1); } else return; } int…
Q: What is the output of the code corresponding to the following code? (a) int X= -5; if (X> 0)…
A: Given X=-5 Condition1: X>0 => -5>0(false) So 1st if block doesn't get executed
Q: Print "Censored" if userlnput contains the word "darn", else print userlnput. End with newline. Ex:…
A: Hey, thank you for your question. To solve this problem, we can add a small coding snippet of…
Q: 1. Write a program that prints your full name. Write a program that prints your full name using…
A: 1.) #include <iostream> using namespace std; int main(){string name;cout<<"Write your…
Q: Evaluate the given expressions. All values are on integer format. int a-10.b=11.c=16.d=0.e=2:…
A: Correct Answer= -12 int a=10,b=11,c=16,d=0,e=2; Here is step by step solution !((a*b!=c) ||…
Q: Write a program that accepts the names of three political parties and the number of votes each…
A: Actually, program is a executable software that runs on a computer.
Q: An Armstrong number is a number such that the sum ! of its digits raised to the third power is equal…
A: As the programming language is not mentioned so I am using C++ language to write a code. Program…
Q: randomly choose a number, accept input from the user, and print whether or not the user is correct.…
A: The answer is given below.
Q: Assuming that a user enters 9, 23, and 3 as input values one after another, separated by spaces,…
A: In step 2, you will get the answer.
Q: int a = 5, b =10; boolean c = (b - 2) < (a + 5); What is the value of c in the above code ? a. True…
A: Here b-2 = 10 - 2 = 8 a+5 = 5 + 5 = 10 b-2 is less than a+5 So the value of c is True.
Q: 1) Which of the following statements a. int c = 20 + (int) (Math.random () * 100); generates a…
A: Solution: 1) d a. int c = 20 + (int) (Math.random() * 100); it will generate a random number…
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: Exercise: Write a program which asks the user to enter input for voltage, frequency and plot the…
A: Note: Answering in python as no language is mentioned. Input : Voltage Frequency Output : Plot of…
Q: 4) Trace the evaluation of the expressions and give the resulting values. (Make sure to give a value…
A: I have solved 4.d in step 2 for you. Kindly check step 2 for the answer. Do upvote if you find this…
Q: Given the following code, what initial values for num will cause an error during execution? int…
A: Please find the answer below :
Q: Q2/-A- What is printed by the following code fragment? Int x1=4 , y1, x2=6, y2; yl=++x1; y2=x2++;…
A: The code fragment given: int x1 = 4, y1, x2=6, y2; y1 = ++x1; y2 = x2++; x2 = y1++; cout…
Q: EXAMINE THE FF. CODE int numValue =2; int answer =0; switch(numValue){ case 1: answer +=1;…
A: 1. The answer(output) if the value of numValue is 22 is 0 2. The answer(output) if the value of…
Q: // This program gets student names continuously until XXX is entered. Then, for each student, quiz…
A: All the return boxes should be connected under one box.
Q: Suppose that the input is 0 5 6 4 9 8 -1. What is the output of thefollowing code? int num;int…
A: complete code: #include <iostream> using namespace std; int main() { //variable declaration…
Q: This is the question - Write a program that inserts parentheses, a space, and a dash into a string…
A: import java.util.Scanner; public class PhoneNumberFormat{ public static void main(String[] args)…
Q: Suppose that the input is 20 -16 -5 15 6 0. What is the output of the following code? int num;int…
A: PROGRAM EXPLANATION: - Initially variable num is declared, and temp variable is declared and…
Q: How many times will the output line be printed in the following code snippet? Please enter your…
A: For every outer loop execution inner loop executes 4 times(since k=0 to k<=3)
Q: Scanner keyboard new Scanner (System.in); String s = keyboard.next (); System.out.println (s);…
A:
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- a. Write a program named CheckMonth that prompts a user to enter a birth month. If the value entered is greater than 12 or less than 1, display an error message; otherwise, display the valid month with a message such as 3 is a valid month. b. Write a program named CheckM0nth2 that prompts a user to enter a birth month and day. Display an error message if the month is invalid (not I through 12) or the day is invalid for the month (for example, not between 1 and 31 for January or between I and 29 for February). If the month and day are valid, display them with a message.What is the output of the following code segment?inte=5,f=10;if(eff0) Write(Red); else Write(Orange);Â a. Red b. Orange c. RedOrange d. nothingWrite a program named Testslnteractive that prompts a user for eight test scores and displays the average of the test scores to two decimal places.
- Write an application that allows a user to enter any number of student quiz scores, as integers, until the user enters 99. If the score entered is less than 0 or more than 10, display Score must be between 10 and 0 and do not use the score. After all the scores have been entered, display the number of valid scores entered, the highest score, the lowest score, and the arithmetic average.Write an application that will take - 5 digit integer from user and calculate the sum of all digits of the integer. The application signature is as follows:- for integer 34567 prints 25.PROBLEM: When creating account: It should be 6 digit pin. (if there is a letter or not 6 digits were put in, output will say "Please retry. It should be a 6 digit pin."). It should also have an authenticator for the pin and if the inputted pin is wrong show "Invalid Pin. Please try again." and if it is still wrong in 3 tries, it'll say "Too many incorrect tries. Exiting program." CODE: import random import sys class ATM(): def __init__(customer, name, account_number, balance = 0): customer.name = name customer.account_number = account_number customer.balance = balance def account_detail(customer): print("\n-ACCOUNT DETAIL-") print(f"Account Holder: {customer.name.upper()}") print(f"Account Number: {customer.account_number}") print(f"Available balance: Nu.{customer.balance}\n") def deposit(customer, amount): customer.amount = amount customer.balance = customer.balance +…
- Write a program that checks to see if the user won the lottery. Assume the winning lottery numbers are 8, 13, 27, 53, and 54. Ask the user for five numbers and compare those numbers to the winning numbers to determine how many matches the user got. In a lottery, the order of the numbers doesn't matter. Test Case 6 Check your lottery numbers here!\nEnter number 1:\n13ENTEREnter number 2:\n53ENTEREnter number 3:\n54ENTEREnter number 4:\n27ENTEREnter number 5:\n8ENTERAll set. The winning numbers were: 8 13 27 53 54\nWOW! Grand prize winner!\n Test Case 7 Check your lottery numbers here!\nEnter number 1:\n13ENTEREnter number 2:\n53ENTEREnter number 3:\n540ENTERMust be between 1 and 99\nEnter number 3:\n54ENTEREnter number 4:\n27ENTEREnter number 5:\n89ENTERAll set. The winning numbers were: 8 13 27 53 54\nWell, you didn't win. You got 4 matching number(s)\nWrite a program that generates a random number in the range of 1 through 1000, and asks the user to guess what the number is. If the user guess is higher than the random number, the program should display Too high, try again. If the users guess is lower than the random number, the program should display Too low, try again. If the user guesses the number, the application should congratulate the user and generate a new random number so the game can start over. If the user doesn't want to continue the game the user should type an appropriate stop symbol to terminate the program (such stop conditions were discussed in the class). For each game iteration, count the number of guesses made by the user and display them. The program should contain the following functions: check_guess(): this function checks if the user's guess is lower, higher or equal to the random number. random_gen(): function that generates one random number for one game iteration main(): the function where the program…I have a calculator program that needs to prompt the user to try again if he does not do what the program says. If he does it wrong one more time, it exits. If he does it right, the program continues as normal. int a, c;char b;cout << "enter an operator" << endl;cin >> b;if (cin.fail())cin.clear();cin.ignore(1000, '\n');cout << "No, that isn't right. Try again." << endl;cin >> b;if (cin.fail())cin.clear();cin.ignore(1000, '\n');cout << "Bad input, exiting..." << endl;return -1;cin >> b;cout << "enter 2 integers" << endl;cin >> a >> c; return 0; The program seems to only say that every input is wrong so please help me with this issue using c++.
- Print a message telling a user to press the letterToQuit key numPresses times to quit. End with newline. Ex: If letterToQuit = 'q' and numPresses = 2, print:Press the q key 2 times to quit. #include <iostream>using namespace std; int main() { char letterToQuit; int numPresses; cin >> letterToQuit; cin >> numPresses; /* Your solution goes here */ return 0;}Tell if the statements are true or false. Let p: 2 + 1 = 3; q: 16 − 9 = 7. (a) ~p ∨ q TrueFalse (b) ~p ∧ ~q TrueFalse (c) ~(p ∧ q) TrueFalse2. Answer TRUE if the expression will return non-zero and FALSE if not. Evaluate using the following declarations:char c = ‘C’, m = ‘?’, i = ‘t’, b = ‘5’;a. isdigit(b); _______________________________b. isalpha(c); _______________________________c. isspacee(m); _______________________________d. isupper(c); _______________________________e. isalnum(b); _______________________________f. ispunct(m); _______________________________g. islower(i); _______________________________h. isupper(c); _______________________________i. isalnum(b); _______________________________j. islower(i); _______________________________