Write a program that asks the user for a number and prints out 2 to the power of that number: Enter a number: 3 8 The answer is 8 because 2**3 = 2*2*2 = 8.
Q: Write a program that generates two integers under 100 and prompts the user to enter the sum of these…
A: Explanation All that remains is to import the random library. randint() is a built-in function in…
Q: Write a program that prompts the user to enter four integersand then displays all possible ways of…
A: Since, here no programming language is specified. So, we are providing the solution in Java. The…
Q: Write a program that prompts the user to enter an integer and prints the value of the following…
A: Below I have provided the Java code of the given Question. Also, I have attached the output of the…
Q: Write a program that reads a floating point number and prints "zero" if the number is zero.…
A: """Program will read a floating-point number and print "zero"if the number is zero.Otherwise, print…
Q: Write a program that prompts the user to enter two positive integers less than 1,000,000,000 and the…
A: Program code: //include the required header files #include <iostream> using namespace std;…
Q: 2. Write a java program that asks the user to type a positive number n and prints the series using…
A: In this question we have to write a JAVA program in which we will take the input from the user for a…
Q: Write a program that reads an integer and checks whether the number is odd or even. You should use…
A: #include<iostream> using namespace std; int main(){ int n; cout << "Enter a…
Q: Write a program that accepts a number entered by the user and validates if it is odd oreven. If it…
A: Sample Response: #python3 program#accept a numbernum = int(input("Enter a number: "))#validate the…
Q: Write a program that prompts the user to enter a three-digit integer and determines whether it is a…
A: JAVA CODE IS GIVEN BELOW:
Q: Write a program that reads ten integers, and then display the number of even numbers and odd…
A: The given program is in the C++ programming language.
Q: Write a program that accepts a number and determines whether the number is positive or negative. If…
A: Given: To write a code in C.
Q: Write a program that asks the user for a number of seconds and prints out how many minutes and…
A: Program: To asks the user for a number of seconds and print as minutes and seconds format.…
Q: Write a program that prompts the user to enter an integer that has five digits find and prints the…
A: Integer data type in C allows a variable to store numeric values. The keyword used is “int” keyword…
Q: Write a program that prompts the user to enter a positive integer and obtains its square root in…
A: Given data is shown below:
Q: Write a program that receives an integer from the user and prints Positive Even, Positive Odd,…
A: The program is written in Python. Check the program screenshot for the correct indentation. Please…
Q: Write a program that asks the user to type 2 integers A and B and exchange the value of A and B.
A: Integer variables are variables that must take an integer value
Q: Write a program that reads from the user a number that represents its grade, and then displays a…
A: As no programming language is mentioned, it is solved using basic C++
Q: Write a program that prompts the user to enter an integer and prints the value of the following…
A: Below I have provided Java Programming. Also, I have attached the screenshot of the code and output…
Q: Write a program that asks the user for a number, and multiplies it by 3 then prints out the result:…
A: Start Prompt the user for input Parse it as integer Multiply the number by 3 Print the result Stop
Q: Write a program that checks to see if the user won the lottery. Assume the winning lottery numbers…
A: Since no programming language is mentioned, I am using python. Algorithm: Start Store the given…
Q: Write a program that prompts the user to enter an integer and prints the value of the following…
A: Here is the java program. See below steps
Q: write a program that asks a user for a number of digits of precision, and prints the value 2/7…
A: import mathn=int(input("Please enter the number of digits of precision for 2/7 :"))print('The value…
Q: Write a program that asks the user to input 10 numbers and counts how many odd numbers that user…
A: Algorithm:- (I) declare array of size 10. (II) using loop take input . (III) use modulo 2 to…
Q: Write a program that inputs two positive integers of, at most, 20 digits and outputs the sum of the…
A: Actually, program is a executable software that runs on a computer.
Q: Write a program that inputs one five-digit number, separates the number into its individual digits…
A: //C++ program #include <iostream> using namespace std; int main(){ int n,a[5],i=4;…
Q: Write a program that asks the user for a number and prints out 100 divided by the number: Enter a…
A:
Q: Write a program that keep asking for a number until you enter a negative number. At the end, print…
A: I give the code in Python because you have not specified any language along with output and code…
Q: Write a program that asks the user for a number and prints out the number cubed (raised to the power…
A: Lets see the solution.
Q: Write a program that accepts a number and determines whether the number is even. If it is even,…
A: Here I written C code for given even problem below. I hope you like it.
Q: Write a program that asks the user for a number then prints out that number with the message shown:…
A: Code to print the message as per output #include <iostream> using namespace std; int main() {…
Q: Write a program to determine the number of thousands, hundreds, tens, and ones in a given integer…
A: Code: #include <iostream>using namespace std; int main(){ int thousands, hundreds, tens,…
Q: under 100 and prompts the user to enter the sum of these two integers. The program then reports true…
A: Here have to determine about program for sum of two numbers.
Q: Write a program that prompts the user to enter two integers. The pro gram outputs how many numbers…
A: NOTE: -Below code is implemented in C++. PROGRAM EXPLANATION: - Integers num1 and num2 are declared…
Q: • Write a program that asks the user for a number n and prints the sum of the numbers 1 ton. By used…
A: <!DOCTYPE html><html><body><script>//asking user to enter valuevar…
Q: Write a program that asks the user to enter n and then it computes the value of the sum: 12 + 22+32…
A: // C++ Program to find sum of square of n numbers.#include <iostream>using namespace std;…
Q: Write a program that asks a user to input non-negative integers (numbers that are >=0) until the…
A: I have provided C++ CODE along with CODE SCREENSHOT and 2- OUTPUT SCREENSHOTS----
Q: Write a program that asks the user for a number, and divides it by 2 then prints out the result:…
A: As per the requirement here I am providing the code. Here is the algorithm. Step 1: Start Step 2:…
Q: Write a program that will ask the user to continuously enter a number until such time that the…
A: I have given c++ code below.
Q: Write a program that takes two integer numbers from user N and x, then calculate the following sum:…
A: Here is Your Code n = int(input("Please Enter a Number N "))x = int(input("Please Enter a Number x…
Q: Write a program that shows the numbers up to the entered number that are divisible by 6 but not…
A: Here I have first of all asked the user to enter a number and stored it into a variable num. Now I…
Q: Write a program that prompts the user to input a decimal number and outputs the number rounded to…
A: Program code: //include the required header files #include<iostream> using namespace std;…
Q: Write a simple LMC(little man computer) program that requests the user to input 2 numbers (say, Aand…
A: Program: INP STA M0 INP STA M1 SUB M1 BRP J1 LDA M1 J1 LDA M1…
Q: Write a program that will compute and display the sum of the factorials of the numbers from 1 to n,…
A: Start Enter number Calculate factorial of number from 1 to n display stop
Q: Write a program that will compute and display the sum of the powers of 2 from the first power to the…
A: Solution-1) C Program: #include <stdio.h> int main(){ // initialize sum as 0 int sum = 0, n;…
Q: Write a java program to check if a number if a power of 2 or not?. You have to take the number from…
A: Given: To write a java program to check if a number is power of two or not.
Q: Write a Java program that prompts the user to enter two positive integers and find their greatest…
A: Given: Greatest common Divisor
Q: Write a program that will display the even numbers from 1 to 100.
A: As per our company guidelines, we are supposed to answer only one question per post and kindly…
Q: Write a program that asks the user for a number and prints out the factorial of that number.
A: Please find the answer below :
Given
Python program to find 2^n.
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 1 images
- Flowcharts of each Programming Task. a. vowelsconsonants b. guessing game c. password #include <iostream>#include <cstring>#include <ctime>#include <cstdlib> using namespace std; string response1, response2, response3, response4;int response; (next to this is void vowelsconsonants() then void startingup() the code is in the picture) void guessinggame(){ start: startingup(); const int size= 4; srand(time(0)); string pool [size] = {"Motherboard", "CPU", "Monitor", "Graphics Card"}; for (int i = 0; i < size; i++) { int word = rand ()% size; string change = pool[i]; pool[i] = pool[word]; pool[word] = change; } for (int i=0; i<1; i++) { if (pool[i] == "motherboard" || pool[i] == "Motherboard" || pool[i] == "MOTHERBOARD" || pool[i] == "MotherBoard") { cout << "\nGuess: It's a printed circuit board that's built inside a computer's casing." <<endl;…Write a Java or C++ program that will display the given menu: A Simple Library System1. Add a Student2. Add a Book3. Display All Students4. Display All Books5. Search a Student6. Search a Book7. Borrow a Book8. Display Borrowed Books9. Return a Book (optional)10. Exit➢ When 1 is chosen, ask the user to enter the student’s information(5-digit ID number,surname, first name, age, and sex)➢ When 2 is chosen, ask the user to enter the book’s information(5-digit book number,Title, Author’s name(Surname, first name), date of purchase, and status (available/notavailable))➢ When 3 is chosen, display list of all students(5-digit ID number, surname, first name,age, and sex)➢ When 4 is chosen, display list of all books(5-digit book number, Title, Author’sname(Surname, first name), date of purchase, and status (available/not available)➢ When 5 is chosen, ask the user if he wants to search the list by Surname or IDnumber. If record is found, display the corresponding record, else display…Write a Java or C++ program that will display the given menu: A Simple Library System1. Add a Student2. Add a Book3. Display All Students4. Display All Books5. Search a Student6. Search a Book7. Borrow a Book8. Display Borrowed Books9. Return a Book (optional)10. Exit➢ When 1 is chosen, ask the user to enter the student’s information(5-digit ID number,surname, first name, age, and sex)➢ When 2 is chosen, ask the user to enter the book’s information(5-digit book number,Title, Author’s name(Surname, first name), date of purchase, and status (available/notavailable))➢ When 3 is chosen, display list of all students(5-digit ID number, surname, first name,age, and sex)➢ When 4 is chosen, display list of all books(5-digit book number, Title, Author’sname(Surname, first name), date of purchase, and status (available/not available)➢ When 5 is chosen, ask the user if he wants to search the list by Surname or IDnumber. If record is found, display the corresponding record, else display…
- 6: forLoops.cpp)a) Print the even numbers between 3 and 43.b) Print every third letter starting with 'B'.c) Print the numbers 1 to 20 in one column right next toanother column with the numbers 20 down to 1.d) Print every other character in the computer's characterset.Write this assignment as one program with 4 voidfunctions.Machine Problem:Write a Java or C++ program that will display the given menu: -----A Simple Library System----1. Add a Student2. Add a Book3. Display All Students4. Display All Books5. Search a Student6. Search a Book7. Borrow a Book8. Display Borrowed Books9. Return a Book (optional)10. Exit ➢ When 1 is chosen, ask the user to enter the student’s information(5-digit ID number,surname, first name, age, and sex)➢ When 2 is chosen, ask the user to enter the book’s information(5-digit book number,Title, Author’s name(Surname, first name), date of purchase, and status (available/notavailable))➢ When 3 is chosen, display list of all students(5-digit ID number, surname, first name,age, and sex)➢ When 4 is chosen, display list of all books(5-digit book number, Title, Author’sname(Surname, first name), date of purchase, and status (available/not available)➢ When 5 is chosen, ask the user if he wants to search the list by Surname or IDnumber. If record is found, display the corresponding…Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A,B,C,D,E" is correct. Each question has one correct answer. Thank you. Part 1 - 9. Given the following code, the output is the date and time of __.Calendar cal = Calendar.getInstance(); TimeZone tz = TimeZone.getTimeZone("Europe/Rome");TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");TimeZone tz = TimeZone.getTimeZone("Asia/Istanbul");System.out.println(cal.getTime()); A. the "Europe/Rome" time zone.B. the time zone is computer is currently set to use.C. the "America/Los_Angeles" time zone.D. the "Asia/Istanbul" time zone.E. All of the three listed time zones. Part 2 - 10. Given the following code, the output is the date and time of __. Calendar cal = Calendar.getInstance();TimeZone tz = TimeZone.getTimeZone("Europe/Rome");cal.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));TimeZone tz = TimeZone.getTimeZone("Asia/Istanbul");System.out.println(cal.getTime()); A. the "Europe/Rome"…
- oks My library > CST 112: Introduction to Programming home > 2.11: Integer division and modulo 211.3. Integer alvision and moquio. ACTIVITY 477358 3451196.73zqy? Jump to level 1 Integer variables totalVolume and itemVolume are read from input. An item takes up itemVolume cubic inches, and the volume of a box is given by totalVolume cubic inches. Assign remainingVolume with the remaining volume after filling as many boxes as possible. Ex: If the input is 13 4, then the output is Remaining volume: 1 1 import java.util.Scanner; 2 3 public class RemainingVolume { 4 5 6 7 TO68L 9 10 11 12 13 14 15 16 17 } public static void main(String[] args) { } Scanner scnr = new Scanner(System.in); int totalvolume; int itemVolume; int remainingVolume; EzyBooks catalog ? Help/FA totalvolume = scnr.nextInt(); itemVolume = scnr.nextInt(); /*Your code goes here / System.out.println("Remaining volume:" + remainingVolume); 1 2 31Write a Java or C++ program that will display the given menu:A Simple Library System1. Add a Student2. Add a Book3. Display All Students4. Display All Books5. Search a Student6. Search a Book7. Borrow a Book8. Display Borrowed Books9. Exit➢ When 1 is chosen, ask the user to enter the student’s information(5-digit ID number, surname, first name, age, and sex)➢ When 2 is chosen, ask the user to enter the book’s information(5-digit book number, Title, Author’s name(Surname, first name), date of purchase, and status (available/not available))➢ When 3 is chosen, display list of all students(5-digit ID number, surname, first name, age, and sex)➢ When 4 is chosen, display list of all books(5-digit book number, Title, Author’s name(Surname, first name), date of purchase, and status (available/not available)➢ When 5 is chosen, ask the user if he wants to search the list by Surname or ID number. If record is found, display the corresponding record, else display an appropriate prompt.➢ When 6 is…Look at this program: int main(){ int x = 4; displayMessage(); return 0;}void displayMessage(){ for(int x = 1; x <= 100; x++) cout << "I love computer science" << endl;} What will the output be? Answers: Nothing. It won't compile because you can't define the variable x inside a loop heading. Nothing. It won't compile because the displayMessage function is being called before it has been defined "I love computer science" 100 times "I love computer science" Nothing. It won't compile because you can't call a void metho
- Q1. a) The Little Man Computer (LMC) is an instructional model of a computer used to teach students all of the basic features of a modern computer in a simplified way. The following Little Man program is supposed to add two input numbers and output the result, i.e., OUT = IN1 + IN2 Mailbox Mnemonic code Numeric code 00 IN 901 01 STO 99 399 02 IN 901 03 ADD 99 199 04 OUT 902 05 COB 000 i) Change the program above to add the numbers 157 and 13. (Hint: these numbers are constants and therefore can pre-exist into memory before the execution of the program). No need to write both mnemonics and numeric codes (opcodes), either one is fine. Please refer to the instruction set provided for all the LMC instruction mnemonics and opcodes.CREATE A PROGRAM THAT ASKS THE USER IF HE/SHE IS PWD OR SENIOR CITIZENIF YES, THEN GIVE 20% OFF IF HE IS BOTH PWD AND SENIOR CITIZEN, GIVE 20% ONLY ASK IF HE HAS A MEMBERSHIP CARD. IF YES, GIVE ANOTHER 3% OFFHi would you be able to modif the menu methode in my code below with the signature public static int menu() The menu should print all of the choices and ask the user to enter a choice. Then menu should declare to read the integer representing the user's choice. This int should be returned to the user. • do { • choice = menu(); • ,,, • ,,, • } while(choice !=5; import java.util.ArrayList;import java.util.Scanner;public class TestProgram {public static void main(String[] args) {ArrayList<Solid> solids = new ArrayList<>();Scanner scanner = new Scanner(System.in);int choice;do {choice = menu();switch (choice) {case 1:System.out.println("Enter radius of sphere:");double radius = scanner.nextDouble();solids.add(new Sphere(radius));break;case 2:System.out.println("Enter radius and height of cylinder:");double cylRadius = scanner.nextDouble();double height = scanner.nextDouble();solids.add(new Cylinder(cylRadius, height));break;case 3:for (Solid solid : solids)…