Write programs that read a sequence of integer inputs and print a. The smallest and largest of the inputs. b. The number of even and odd inputs. c.Cumulative totals. For example, if the input is 1 7 2 9, the program should print 1 8 10 19. d. All adjacent duplicates. For example, if the input is 1 3 3 4 5 5 6 6 6 2, the program should print 3 5 6.
Q: Write a program to check if a number is a prime number. 1) let user input a number 2) check if its…
A: Note: Programming language is missing in the question. So we will answer this program in C, and C++…
Q: Write a program that reads in a number N and then output of the numbers from 1 to N. If the input is…
A: Define header file <iostream> for io operations. Define function func with parameter n. Define…
Q: Write a program whose inputs are three integers, and whose output is the smallest of the three…
A: Java is one of the most extensively used language, and In most of the back end development projects,…
Q: Write a program in kotlin to add two given numbers and print the results.
A: Required:- Write a program in kotlin to add two given numbers and print the results. approach:-…
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 will continually ask the user to enter a positive number from standard input…
A: Type casting is a feature to convert the type of variable from one datatype to another. There are…
Q: Write a program that reads in hours, minutes, as input, and outputs the time in minutes only.
A: The language i used is C++. I explained the program in comments of the code and also attached the…
Q: Write a program that reads an arbitrary number of integers that are in the range 0 to 50 inclusive…
A: To count occurrence of numbers between 0 and 50, create an array of size 50 and for each entered…
Q: Write a program to read a number representing the time in 24-hours (i.e., 4-digits ). Then find the…
A: Modulo(%) operator: The modulo operator (%) also called a remainder operator which is used to get…
Q: Write a program whose input is a string which contains a character and a phrase, and whose output…
A: input string store string first character in another variable. count number of that variable…
Q: Sites like Zillow get input about house prices from a database and provide nice summaries for…
A: Given requirement, Sites like Zillow get input about house prices from a database and provide nice…
Q: Write a program that reads in an integer and breaks it into a sequence of individual digits. For…
A: We will be solving the question in Python for easy understanding. We will be taking our input in a…
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 takes a bank account balance and an interest rate as an input. And then outputs…
A: Given: Write a program that takes a bank account balance and an interest rate as an input. And then…
Q: Write a program whose input is a character and a string, and whose output indicates the number of…
A: Program: //import the required packages import java.util.Scanner; //define a class Main public class…
Q: Write a program that reads an arbitrary number of integers that are in the range 0 to 50 inclusive…
A: ## As no programming language mentioned, the code is written in Python. f_dict = {}…
Q: Write a program that reads any 5 numbers as in the given sample of output below: Sample of…
A: Note: As no programming language is mentioned, using python. Get 5 input values from the user and…
Q: Write a program that takes the input of the number of rows and then prints the diamond for the given…
A: Program Approach: Define method diamond and pass row as an argument in it. Variable a is declared…
Q: Write a program that takes a string as input and outputs the string in all capital letters and the…
A: Given: Write a program that takes a string as input and outputs the string in all capital letters…
Q: Write a program that takes in an integer in the range 20-98 as input. The output is a countdown…
A: 1. 1st digit = number % 10 2. 2nd digit = number / 10 3. If 1st digit is equal to 2nd digit 1.…
Q: Write a program that reads an integer between 0 and 1000 and multiplies all the digits in the…
A: SINCE NO PROGRAMMING LANGUAGE WAS MENTIONED, THIS CODE IS WRITTEN IN PYTHON.
Q: Write a python program that converts a Decimal Integer number to a Binary Number. "A decimal can be…
A: code: #define the method def decBin(val): #condition to compare the value if val…
Q: Write an integrated program that asks you to enter three real positive values and then prints the…
A: In the java program, add the necessary libraries to it. For example, to obtain the three inputs from…
Q: Write a program that converts an input inch(es) into its equivalent centimeters. Take note that one…
A: According to the question we need to write the program that converts an input inch(es) into its…
Q: A. Write a program in "SUM.C" which reads two integers and prints out the sum, the difference and…
A: To do: Find sum, difference, product, division and remainder of two numbers. The program ask user to…
Q: Write a program that reads three numbers and prints "increasing" if they are in increasing order,…
A: Python program to solve the given problem is below.
Q: 4) Write a program that reads three numbers and prints "all the same" if they are all the same, "all…
A: CODE:- x = input("Enter the 1st integer ")y = input("Enter the 2nd integer ")z = input("Enter the…
Q: Did you know that in lotteries, a 3-digit number with the same numbers in all digits like 777 will…
A: The question asks that we are given a 3 digit number and another number. if all of the digits…
Q: Write a program to read A[n, n] of numbers, then put 10 instead each even positive number.
A: Program is written in java and commented correctly with output. Algorithm: 1. Read array of n rows…
Q: Write a python program that takes two numbers (Integer) as inputs from the user. Consider the 1st…
A: Algorithm: Start Read no.of rows n, and columns m Iterate through the loop from j=1 to j=n+1(outer…
Q: Write a program, which takes an input from the user, if the number is between 90 100, Print A Grade,…
A: Since no programming language is mentioned, I am using python Algorithm: 1. Start 2. Take input…
Q: Write a program that reads a person’s name in the following format: first name, then middle name or…
A: Given: Write a program that reads a person’s name in the following format: first name, then middle…
Q: Write a program whose inputs are three integers, and whose output is the smallest of the three…
A: Below is the code in python and output of the question:
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: Write a program that reads multiple blood sugar rates for a patient for multiple visits to a…
A: #include <bits/stdc++.h>using namespace std; int main(){ vector<float> sugar_rate;…
Q: Write a program that inputs a line of text from the user and counts; the total numbers of…
A: take user input of a line of text vowelCount ← 0 : variable for calculation and show output vowel…
Q: Write a program that reads in three numbers from the keyboard and then prints those numbers in…
A: Two questions are asked. So the only the first question will be answered. Please upload another…
Q: Write a program with total change amount as an integer input that outputs the change using the…
A: We need to define a function, exact_change that returns the number of dollars, quarters, dimes,…
Q: Write a program whose input is a string which contains a character and a phrase, and whose output…
A: The user inputs a character and a phrase. The entered string is separated into individual elements.…
Q: Given an integer value N, write a program to print a diamond pattern of 2*N rows as shown below.…
A: I give the code in Python along with output and code screenshot(because no particular language is…
Q: Write a program whose input is a string which contains a character and a phrase, and whose output…
A: Hello Student I will explain the whole solution in next stes Please do like :-
Q: Write a program whose inputs are three integers, and whose outputs are the largest of the three…
A: Python code for above: # function to return largest def largest_number(num1, num2, num3):…
Q: Write a program whose input is two integers. Output the first integer and subsequent increments of 5…
A: The code for the above-given question is given below:
Q: Write a program which takes in 3 digits as input from the user and shows the mean of even numbers.…
A: i give this question answer with full features with sum, average, max, min org 100h .dataarray:…
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 program that asks the user for an integer and returns an approximate integral value for its…
A: I have attached the Screenshot of the code as well as the typed code and output of the code.
Write programs that read a sequence of integer inputs and print
a. The smallest and largest of the inputs.
b. The number of even and odd inputs.
c.Cumulative totals. For example, if the input is 1 7 2 9, the
d. All adjacent duplicates. For example, if the input is 1 3 3 4 5 5 6 6 6 2, the program should print 3 5 6.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- Write a program that calculates the equivalent resistance of a circuit. n electrical resistors with resistance values R1, R2,.., Rn are said to be connected in parallel if the same voltage is applied across each. Their equivalent resistance Reg is related to the values R1, R2, ..., Rn by: 1 1 1 1 + +...+ R R R, R. "eq Write a program that prompts the user to enter the resistance of n resistors. The user should be prompted continuously by using a while loop until a zero or negative value is entered (the program should count the number of resistors n entered by the user and store the values in an array). Use another separate loop to print the resistance values entered by the user and the equivalent resistance Reg. Test your program with R1= 1 kn, R2= 2 kn, R3= 4 kQ and R4= 8 kQ.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;}Write a program that reads the full name of a student; and then prints it in the form: last first middle initial. Example: Input: Ali Hamad Al-Harbi Output: Al-Harbi, Ali H. Write a program that reads a string composed of three words separated by a space, and then print each word on a separate line. Input: one two three Output: One two three
- Your relative, who goes to primary school and has just learned the multiplication table, asks you to constantly ask him. You wanted to gamify it. The computer will randomly scan in the multiplication table and the user will write the answer on the screen. There will be 10 questions in total and at the end the number of questions, the number of correct answers and the number of wrong answers will be printed on the screen. Also, write a program that will print if the percentage of success is below 80, it remained, and if it was above, it passed. (On C# ConsoleApp(.Net Framework)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 to determine the number of thousands, hundreds, tens, and ones in a given integer number (You can use integer division and modulus). For example, if you entered 8532, the program will print 8 thousand, 5 hundred, 3 tens and 2 ones. Then, let the program print the number on the screen in a reverse way as 2358 and print its double as well (2* 2358) 4716.
- 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…Write a program that reads from the user a character (*q' or 'c'). If the character is 'c', the program reads from the user the radius r of a circle and prints its area. If the user enters 'q', the program asks the user to enter the length and width of a quadrilateral. We assume the quadrilateral is either a square or rectangle. You should print if the quadrilateral is square or rectangle. Otherwise, it prints "Wrong character" PS: Use the following formulas : area of circle=3.14*r? IWrite a program that will determine how many of a set of 10 numbers are even and how many are odd. a. Read in one number at a time. b. Compute and display the number of even integers and the number of odd integers. Hint: You can use the modulus operator (%) to determine if each integer is even or od. Your output should look like this: Enter integer: 2 Enter integer: 4 Enter integer: 3 Enter integer: 5 Enter integer: 6 Enter integer: 4 Enter integer: 77 Enter integer: 5 Enter integer: 89 Enter integer: 45 There are even numbers in the list 6 odd numbers in the list 4 There are >>>
- in C Write a program that inputs a line of text from the user and counts; the total numbers of vowels (‘a’ / ‘A’, ‘e’ / ‘E’, ‘i’/’I’, ‘o’/’O’, ‘u’/’U’), the total number of consonants (letters that are NOT vowels), the total number of digits (‘0’ – ‘9’), and the total number of white space characters in the given line of text.Write a program that reads from the user a character ('q' or 'c'). If the character is 'c', the program reads from the user the radius rof a circle and prints its area. • If the user enters 'q', the program asks the user to enter the length and width of a quadrilateral. We assume the quadrilateral is either a square or rectangle. You should print if the quadrilateral is square or rectangle. • Otherwise, it prints "Wrong character" PS: Use the following formulas: area of circle=3.14*r Sample Run1: Enter a character (q or c): q Enter the Length and Width: 80 150 |It is a rectangle Sample Run2: Enter a character (q or c): q Enter the Length and Width: 80 80 It is a square Sample Run3: Enter a character (q or c): c Enter the radius: 2 The area of the circle is 12.56 Sample Run4: Enter a character (q or c): d Wrong characterYour relative, who goes to primary school and has just learned the multiplication table, asks you to constantly ask him. You wanted to gamify it. The computer will randomly scan in the multiplication table and the user will write the answer on the screen. There will be 10 questions in total and at the end the number of questions, the number of correct answers and the number of wrong answers will be printed on the screen. Also write a program that will print if the percentage of success is below 80, it remained and if it is above it, it passed.