Write a program that reads a number and finds it is a prime or not. 0. A prime number is a number such that 1 and itself are the only numbers that evenly divide it. For example: 3, 5,7, 11, 13, 17. 2.
Q: Write a program that prompts for and reads the radius and the height of a cylinder (in centimeters).…
A: Answer : Here is the C++ code: //included header file #include<iostream> //included namespace…
Q: Write a program that asks the user for a word, then prints out the word between the word bread, to…
A: Please find the answer below :
Q: Write a program that takes all 3 sides of a triangle and prints whether the triangle is equilateral,…
A: Algorithm: Start Input three sides of the triangle from user If side1==side2 and side2==side3 then…
Q: Write a program that finds five prime numbers largerthan Long.MAX_VALUE.
A: Program: //import math package for mathematical operations import java.math.*; public class Main {…
Q: Write a program that reads a series of strings and prints only those beginning with the letters…
A: #include<stdio.h> #include<stdlib.h> int main() // main function { char…
Q: Write a simple program in Java to display the age of a father where The sum of ages of two sons is 5…
A: import java.util.Scanner; public class fAge { public static void main(String[] args)…
Q: Write a program that generates 1,000 lowercase letters randomly, counts the occurrence of each…
A: Program Plan: • In HistoGram class, o Create a window, set its title. o Create a canvas and add it…
Q: Write a program to find the equivalent series and parallel resistance for 3 resistor values. Your…
A: As there is no programming language mentioned in question . program is attempted in c language user…
Q: write a Java program that reads a grid of letters and a specified word from the user, counts how…
A: Here's the algorithm that needs to be followed :- Input all the necessary data Traverse through the…
Q: Write a program that reads the height h and radius r of Right Circular Cone and finds the surface…
A: Please find the answer below :
Q: Write a program to process a collection of daily high temperatures. Your program should count and…
A: Required:
Q: Write a program that reads 11 integers, compares eachinteger with the 11th integer, and displays…
A: Note: In this question, the coding language is not specified then we are doing this question in the…
Q: Write a program (Li and displays, using asterisKs, a filled diamond. For example, if the generated…
A: Answer Code in Python n = int(input("Enter the value:")) for i in range(n): print(" "*(n-i),…
Q: Write a Java program that computes the sum of two rational numbers given by the user. [Note: If two…
A: We need to read the input values a,x,b and y from keyboard ,compute the number and display the…
Q: Write a program that reads a word and prints the number of syllables in the word. For this exercise,…
A: Actually, python is a easiest programming language. It is a dynamically typed programming language.…
Q: Write a Java program that computes the sum of two rational numbers given by the user. [Note: If two…
A: I have provided java code to find the sum of two rational numbers.
Q: Write a program in Java to make such a pattern like right angle triangle with number increased by 1.…
A: Input : Size of triangle i.e number of rows Output : Pattern like right angle triangle
Q: Write a program that reads a person's first and last names, separated by a space. Then the program…
A: The program will read entered name and stores into a variable. using the split method, it splitas…
Q: Write a Java program that asks the user to enter positive numbers, and store it into (myArray) of…
A: import java.util.*;public class Main{ public static void main(String[] args) { Scanner scan =…
Q: write a program that prints all multiples of 5 between 5 and 50 inclusive and then reads a number…
A: Since you have not mentioned any specific programming language, we will solve this question for you…
Q: Write a program that reads HAND_SIZE cards from the user, then analyzes the cards and prints out the…
A: Given: Write a program that reads HAND_SIZE cards from the user, then analyzes the cards and…
Q: Write a program that finds summation of all factors of a given number x. For example, the factors of…
A:
Q: Write a program that prints out first 40 numbers divisible by 3.
A: As you have not mentioned the programing language we are providing the program in Python language.
Q: Write a program that reads the height h and radius r of Right Circular Cone and finds the surface…
A: In this question, we are asked to create a java program to calculate the surface area and volume of…
Q: Write a program that reads text from the user and reverses the order of every number that appears in…
A: Solution:-- 1)The given question has required for the solution to be provided with the help of the…
Q: Write a program that reads an integer age of kids, finds the maximum of them, and counts its…
A: #include <iostream> using namespace std; int main(){ int…
Q: Write a program that displays the classic BINGO game, displays a BINGO card (5x5 square), and tests…
A: I have solve the problem in C++ code with comments for easy understanding :
Q: Write a program that simulates picking a card from a deckof 52 cards. Your program should display…
A: Programming language is missing in the question. So we will answer this program in Java language. If…
Q: Write a program that displays all the numbers from 1 to 500, 5 per line, that are divisible by 3 and…
A: A program that displays all the numbers from 1 to 500, 5 per line, that are divisible by 3 and 4.…
Q: Write a program in c++that reads a positive integer n, and prints the first n even numbers. For…
A:
Q: Write a Python program that takes a number and tells if it is a perfect number or not. [The input…
A: Using python need to write a program which shows whether number is perfect number or not. For…
Q: Write a program that will read a number and will display the factors of the number. Factors are…
A: Program code: x=int(input("Enter a number: "))print("The factors of",x,"are:")for i in range(1, x +…
Q: Write a program that simulates a simple calculator. It reads two integers and a character. If the…
A: Program: //header file declarations #include<iostream> using namespace std; int main() {…
Q: Write a program that simulates picking a card from a deck of 52 cards. Your program should display…
A: JAVA Program: public class Main { public static void main(String[] args) { int card = (int)…
Q: Write a program that simulates flipping a coin one million times and displays the number of heads…
A: Code: public class CoinFlip { public static void main(String[] args) { int heads = 0; int…
Q: Write a program that inputs a number and checks whether it is a perfect number or not. A perfect…
A: PERFECT NUMBERS A perfect number is a number that is equal to the sum of its proper divisors.…
Q: Implement a program that calculates the bill of a sandwich stand. The program should ask the user to…
A: We need to write a program that calculates the bill of a sandwich stand. The program will ask the…
Q: Write a program that generates a random number between 1 and 50 and asks the user to guess it. As a…
A: EXPLANATION: - The program involves these main tasks: - Generate the random number in range 1 to…
Q: Write a program that finds the equivalent series and parallel resistance for a collection of…
A: The answer is
Q: Write a program to find two points that are nearest to each other. For example, points (1, 1) and…
A: I have added the comments. I have also added the screenshot. The class name is Test. So the commands…
Q: Write a program that displays all the numbers from 300 to 400, 5 per line, that are divisible by 3…
A: Since the programming language is not mentioned, so we'll do it in java. The programming methodology…
Write a
Step by step
Solved in 3 steps with 2 images
- If you add up all the digits in 468, you get 4 + 6 + 8 = 18. The square and cube of 468 are 219024 and 102503232, respectively. Interestingly, if you add up the digits of the square or cube, you get 18 again. Are there other integers that share this property? Write a program that lists all positive integers k less than 1000 such that the three numbers k, k2, and k3 have digits that add up to the same number.IN JAVA Alice and Bob are playing a board game with a deck of nine cards. For each digit between 1 to 9, there is one card with that digit on it. Alice and Bob each draw two cards after shuffling the cards, and see the digits on their own cards without revealing the digits to each other. Then Alice gives her two cards to Bob. Bob sees the digits on Alice’s cards and lays all the four cards on the table in increasing order by the digits. Cards are laid facing down. Bob tells Alice the positions of her two cards. The goal of Alice is to guess the digits on Bob’s two cards. Can Alice uniquely determine these two digits and guess them correctly? Input The input has two integers p,q (1≤p<q≤9) on the first line, giving the digits on Alice’s cards. The next line has a string containing two ‘A’s and two ‘B’s, giving the positions of Alice’s and Bob’s cards on the table. It is guaranteed that Bob correctly sorts the cards and gives the correct positions of Alice’s cards. Output If Alice can…HangmanAA.java For this program, you will create the game Hangman. (If you are unsure of how to play Hangman, Google it.) The game will start by asking player 1 for a word or phrase (can be multiple words). Then player 1 will be asked how many missed guesses are allowed by player 2. Once this information is received, player 2 will take over. (Have the program print many blank lines of space so that player 2 can’t see what player 1 entered.) The instructions should be displayed for player 2 as well as the number of misses they’re allowed to make before they lose the game. The screen should also output dashes or underscores to represent each letter of player 1’s secret word/phrase. Player 2 should guess one letter at a time. Case should not matter. Typing x or X should give the same result. If that letter is present in the mystery phrase, then it should be displayed. (It will replace the dash/underscore in that spot. Spaces, punctuation, and all other non-alphabetic characters should…
- In mathematics, a prime number is a natural number greater than 1 that is not a product of two smaller natural numbers, i.e. is it has only two factors 1 and itself. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime because the only ways of writing it as a product, 1 × 5 or 5 x 1, involve 5 itself. Note that the prime number series is: 2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, .. a. Write a Java method named isPrime that takes a natural number as a parameter and returns the if the given number is prime or not using the following header: Public static boolean isPrime (int num) b. Write a Java class called PrimeNumbers that: Reads from the user a natural value n (should be less than or equal 200). Prints a list of the prime numbers from 2 to n and their number and values. The program has to work EXACTLY as given in the following sample run. Hints: You should create a single dimension array to store the prime…In mathematics, a prime number is a natural number greater than 1 that is not a product of two smaller natural numbers, i.e. is it has only two factors 1 and itself. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime because the only ways of writing it as a product, 1 × 5 or 5 × 1, involve 5 itself.Note that the prime number series is: 2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, …a. Write a Java method named isPrime that takes a natural number as a parameter and returns the if the given number is prime or not using the following header: Public static boolean isPrime(int num) b. Write a Java class called PrimeNumbers that: o Reads from the user a natural value n (should be less than or equal 200). o Prints a list of the prime numbers from 2 to n and their number and values. o The program has to work EXACTLY as given in the following sample run.java: Run length coding is a method to represent a string in a more compact manner. Each character that occurs more than 2 times in a row is represented by the character and a number following it. Two examples are: "abba" → "abba""abcccbbbba" → "abc3b4a"Write a function that calculates how many characters the encoded string is shorter than the original.
- Let A = {a, b, c} and B = {u, v}. Write a. A × B b. B × AHelp code in Java 21. Compound InterestWhen a bank account pays compound interest, it pays interest not only on the principal amount thatwas deposited into the account, but also on the interest that has accumulated over time. Suppose youwant to deposit some money into a savings account, and let the account earn compound interest for acertain number of years. The formula for calculating the balance of the account after a specifiednumber of years is:A = P ( 1 + r n ) n tThe terms in the formula are:A is the amount of money in the account after the specified number of years.P is the principal amount that was originally deposited into the account.r is the annual interest rate.n is the number of times per year that the interest is compounded.t is the specified number of years.Write a program that makes the calculation for you. The program should ask the user to input thefollowing:The amount of principal originally deposited into the accountThe annual interest rate paid by the accountThe…Using Javascript and HTML: An interesting application of computers is drawing graphs and bar charts (sometimes called histograms). Write a script that reads five numbers between 1 and 30. For each number read, output HTML5 text that displays a line containing the same number of adjacent asterisks. For example, if your program reads the number 5, it should out HTML5 test that displays *****.
- Java Programming: Write a program that reads five integer values from the user, then analyzes them as if they were a hand of cards. When your program runs it might look like this (user input is in orange for clarity): Enter five numeric cards, no face cards. Use 2 - 9. Card 1: 8 Card 2: 7 Card 3: 8 Card 4: 2 Card 5: 9 Pair! (This is a pair, since there are two eights). You are only required to find the hands Pair and Straight.please code in python You place a pawn at the top left corner of an n-by-n chess board, labeled (0,0). For each move, you have a choice: move the pawn down a single space, or move the pawn down one space and right one space. That is, if the pawn is at position (i,j), you can move the pawn to (i+1,j) or (i+1, j+1). Ask the user for the size of a chessboard, n (integer). Find the number of different paths starting from (0,0) that the pawn could take to reach each position on the chess board. For example, there are two different paths the pawn can take to reach (2,1). Look at the diagrams below to convince yourself of this. You can see the four paths that you can take by move 2. Start -> Move 1 -> Move 2 (0,0) -> (1,0) -> (2,1) (0,0) -> (1,0) -> (2,0) (0,0) -> (1,1) -> (2,1) (0,0) -> (1,1) -> (2,2) Print the board with the number of ways to reach each square labeled as shown below. For example: Enter a board size: 4 1 0 0 0 1 1 0 0 1 2 1 0 1 3 3 1In Java: An acronym is a word formed from the initial letters of words in a set phrase. Write a program whose input is a phrase and whose output is an acronym of the input. If a word begins with a lower case letter, don't include that letter in the acronym. Assume there will be at least one upper case letter in the input. Ex: If the input is: Institute of Electrical and Electronics Engineers the output should be: IEEE Your program must define and call a method thats returns the acronym created for the given userPhrase.public static String createAcronym(String userPhrase) Hint: Refer to the ascii table to make sure a letter is upper case. import java.util.Scanner; public class LabProgram {/* Define your method here */public static void main(String[] args) {/* Type your code here. */}}