Write a program that reads tenintegers, and then display the number of even numbers and odd numbers. Assumethat the input ends with 0. Here is the sample run of the program. Enter numbers: 1 2 3 2 1 6 3 4 5 2 3 6 8 9 9 0 ↵EnterThe number of odd numbers: 8The number of even numbers: 7
Q: Write a program that prints out the letters of a word, each followed by a dot (full stop or period)…
A: Wrtting the program below with comments :
Q: Write a program that prints all numbers between 1 and 100 that are divisible by both 5 and 7.
A: for num in range(1,100): if num%5==0 and num%7==0: print(num)
Q: Write a program that print the numbers 2 to 10 in increments of 2. The output of your program should…
A: i have given an detail answer in step 2.
Q: Write a program that reads a floating point number and prints "zero" if the number is zero.…
A: Please find the answer below :
Q: Write a program that keeps on taking numbers from the user, until the user enters any input that it…
A: Answer: Java Source Code: import java.util.*;import java.lang.*;public class Main { public static…
Q: Write a program that reads in hours, minutes, and seconds as input, and outputs the time in seconds…
A: h=int(input("Enter hours: "))m=int(input("Enter Minutes: "))s=int(input("Enter Seconds: "))sec=…
Q: Write a program that generates and prints 50 random integers, each between 3 and 6. Write a program…
A: 1)Code: as you have not mentioned the coding language i am giving the code in java class Main {…
Q: Write a program to read a number (n). Then print all numbers from 0 to n that are not equal to 1 or…
A: Here the program is developed as per the requirement. Note: In the question programming language is…
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 simulates flipping a coin twomillions times and displays the number of heads…
A: Program code: //import the required packagesimport java.util.*;//Declare class HeadTailCoinpublic…
Q: Write a program that sum up all prime numbers within the range of 0 and 1000.
A: Sample Response: #Python3 program to find teh sum of all prime numbers between 0 and 1000def…
Q: Write a program that calculates a “moving (rolling) average” of ten integer numbers entered by the…
A: We need to write a Python code to find moving average.
Q: Write a program that prompts the user to enter theminutes (e.g., 1 billion), and displays the number…
A: Program code: //IMPORT Scanner class import java.util.Scanner; //define a class NoOfYears public…
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: Suppose that the first number of a sequence is x, where x is an integer. Define a0= x; an+1=an/2 if…
A: Following is the C++ program that takes as input from user the value of x. Then using the while loop…
Q: Write a program which reads two integers and prints out the sum, the difference and the product.…
A:
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 takes a positive integer x greater than zero typed in by the user, and prints…
A: #include <stdio.h> int main() { //declaring variable int x,i; //take input from…
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 guess a random number between 1 and 10. If they guess right,…
A: Program: # initialize the score to 0 score = 0; # the number to guess is 5 number = 5; # run the…
Q: Write a program that converts a given number of minutes into hours:minutes:seconds format. For…
A: C++ Program for above : #include <iostream> #include <iomanip> using namespace std;…
Q: Write a program that repeatedly reads in integers untila negative integer is read. The program also…
A: 1) Below is Java program that repeatedly reads in integer until negative integer is read. It track…
Q: Write a program that examines three variables - p, q, and r - and prints the smallest even number…
A: As per our guidelines we are suppose to answer only first question. Kindly repost other questions…
Q: .Write a program that reads the integers between 1 and 50 and counts the occurrences of each. Assume…
A: .Write a program that reads the integers between 1 and 50 and counts the occurrences of each. Assume…
Q: Write a program that reads the value of x and y, then if x is bigger than or equal y calculate and…
A: Math functions used in the program Math.pow() Math.cos The program first inputs the value of x and…
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 reads at most 100 integers between 1 and 100 and counts the occurrence of each…
A: C program is given below:
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 reads in a series of integer numbers, and determines how many positive odd…
A: Since the programming language is not mentioned, so we'll do it in python. The programming…
Q: Write a program that continues accepting user inputs as float numbers until the input is an empty…
A: Code: #declaring an empty list lst=[] #loop to take input continously while True: #taking…
Q: Write a program that reads the length and width of a rectangle as integers from the keyboard and…
A: Given: We are given a program that reads input as length and width of a rectangle as integers.…
Q: Write a program that reads some integers between 1 and 100 and counts the occurrences of each.
A: Lets see the solution.
Q: Write a Java program that prompts the user to enter 4 integers and prints equal if all four are…
A: Let the four integers be n1, n2, n3, n4. All the four integers will be equal if n1==n2 and n1==n3…
Q: Write a program that takes website names as keyboard input until the user types the word stop and…
A: Given :- Write a program that takes website names as keyboard input until the user types the word…
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 down a program that will take an English letter as input and will print the next letter in the…
A: Input a character and then add 1 to it and display the updated character
Q: Write a program that reads 10 numbers, finds the largest number, prints it, finds the smallest…
A: Given: Write a program that reads 10 numbers, finds the largest number, prints it, finds the…
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 to read a number (n). Then print all numbers from 0 to n that are not equal to 2 or…
A: Step-1: Start Step-2: Declare variable n and take input from user Step-3: Start a for loop i=0 to n…
Q: Write a program that asks the user for a negative number, then prints out the product of all the…
A: Solution: Since any specific language for the above question is not mentioned, we have solved…
Q: Write a program that reads an unspecified number of scores anddetermines how many scores are above…
A: Since you are not mentioning the programming language, here we are using Java to complete the…
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 reads an integer and displays all its smallest factors in an increasing order.…
A: Since the program language not specified the program has been developed using Java to satisfy the…
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: 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…
Write a
integers, and then display the number of even numbers and odd numbers. Assume
that the input ends with 0. Here is the sample run of the program.
Enter numbers: 1 2 3 2 1 6 3 4 5 2 3 6 8 9 9 0 ↵Enter
The number of odd numbers: 8
The number of even numbers: 7
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Write a program that prompts the user to enter an integer anddisplays whether the integer is an odd number or not. Here are the sample runs: Enter an integer: 200 ↵Enter200 is even number Enter an integer: 211 ↵Enter211 is odd numberGiven the sample code above in generating a random number. Create a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows. 1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. (Don't display the computer's choice yet.) 2. The user enters his or her choice of "rock", "paper", or "scissors" at the keyboard. (You can use a menu if you prefer.) 13. The computer's choice is displayed. 4. A winner is selected according to the following rules: a. If one player chooses rock and the other player chooses scissors, then rock wins. (The rock smashes the scissors.) b. If one player chooses scissors and the other player chooses paper, then scissor wins. (Scissors cuts paper.) c. If one player chooses paper and the other player…Statistics are often calculated with varying amounts of input data. Write a program that prompts for and takes any number of non-negative integers as input, and outputs the average and max. A negative integer ends the input and is not included in the statistics. Example program run (the user types only the numbers, in this case 15 20 0 5 -1): Enter numbers separated by spaces, with a negative number to quit: 15 20 0 5 -1 Average = 10 Max = 20 #include <iostream>using namespace std;/* program that prompts for and takes any number of non-negative integers as input, and outputs the average and max. A negative integer ends the input and is not included in the statistics. Example program run (the user types only the numbers, in this case 15 20 0 5 -1): Enter numbers separated by spaces, with a negative number to quit:15 20 0 5 -1 Average = 10 Max = 20*/ int main() { /* Type your code here. */ return 0;}
- Question 1 Write a program that asks the user to enter the number of passengers in an airplane and the weight of baggage for these passengers. Your program should then print the average weight of all baggage; it should also print the weights in reverse order. Sample run: Enter the number of passengers in the airplane: 8 Enter the weights of 8 baggage: 16 45 60 13 24 29 50 30 The average weight of all baggage is 33.375 The entered weights in reverse order are 30 50 29 24 13 60 45 16A palindromic number is a number that is the same when written forwards or backwards. The first few palindromic numbers are therefore are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 323 Input a number from the user. Write a program that reverses the digits of a number. Use this program to find if the number is a palindrome. Print if the number is palindrome or not.Given the sample code below in generating a random number. Create a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows. 1. When the program begins, a random number in the range of 1 through 3 is generated.If the number is 1, then the computer has chosen rock. If the number is 2, then thecomputer has chosen paper. If the number is 3, then the computer has chosen scissors.(Don’t display the computer’s choice yet.)2. The user enters his or her choice of “rock”, “paper”, or “scissors” at the keyboard.(You can use a menu if you prefer.)3. The computer’s choice is displayed.4. A winner is selected according to the following rules:a. If one player chooses rock and the other player chooses scissors, then rock wins.(The rock smashes the scissors.)b. If one player chooses scissors and the other player chooses paper, then scissorwins. (Scissors cuts paper.)c. If one player chooses paper and the other player chooses rock, then…
- Create a different version of the program that: Takes a 3-digit number and generates a 6-digit number with the 3-digit number repeated, for example, 391 becomes 391391. The rule is to multiply the 3-digit number by 7*11*13. Takes a 5-digit number and generates a 10-digit number with the 5-digit number repeated, for example, 49522 becomes 4952249522. The rule is to multiply the 5-digit number by 11*9091. Times 11: A two-digit number can be easily multiplied by 11 in one's head simply by adding the digits and inserting that sum between the digits. For example, 43 * 11 has the resulting digits of 4, 4+3, and 3, yielding 473. If the sum between the digits is greater than 9, then the 1 is carried to the hundreds place. Complete the below program. Create a different version of the program that: Takes a 3-digit number and generates a 6-digit number with the 3-digit number repeated, for example, 391 becomes 391391. The rule is to multiply the 3-digit number by 7*11*13. Takes a 5-digit…Write a program that keeps reading integers from the user until he enters zero. The programshould then displays the following: Sum of odd numbers Average of even numbers (use loops)f. A laborant in a laboratory does a number of antigen tests in one day. Write a program that simulates the number of antigen tests done in a day in a laboratory, displays the number of positives and negatives, and calculates the % of positives in one day. Your program needs to first generate a random number that will show the number of tests done in a day. One laboratory in a day cannot do more than 100 tests and less than 1 (they do at least one). Then for each of the tests, your program needs to generate a random number to show whether they are positive or negative. In order to write this program, you need to have the following three functions used by the main function: test result (void): This function generates a test result. It should randomly return either one or zero. 1 means positive test result and 0 means negative test result. float positive percentage (int,int) : This function takes the total number of positives and the total number of tests and returns the % of positives.…
- Write a program that displays every integer between 1 and 100 that is divisible by 5 or 7, but not both. Write it using While and for.Write a program that lets the user guess whether a randomly generated integer would be even or odd. The program randomly generates an inte- ger and divides it by 2. The integer is even if the remainder is 0, otherwise odd. The program prompts the user to enter a guess and reports whether the guess is correct or incorrect.Write a program that reads ten integers, and then display the number of even numbers and odd numbers. Assume that the input ends with 0.