Write a program that takes any number of integers as input, and outputs the average and max.
Q: Python 3.7.4: I'm wasting a second request for the same question because the person who answered the…
A: This question asks about to check year is Leap year or not. So, let's know about Leap Year : Leap…
Q: What is the value stored in X[4] after the following code segment is executed? int X[5] int i = 1;…
A: Objective: Given a code segment including a for loop and array. The array elements are populated…
Q: Exercise 3. Use the program shell below to implement a program called SumDigits. When completed,…
A: #include <iostream>using namespace std; int main(){ int counter; //loop-control…
Q: 23. In Javascript write a program to print the first 5 even natural numbers and the sum of the first…
A: Write a Javascript program to print the first 5 even natural numbers and the sum of the first 5 even…
Q: 14. Give an example of program that calculate the following sum: n k ij i=0 j=0
A: The example in the C++ programming language is shown below. Sample Response: //C++ program to…
Q: int [] X = {12,15,12}; int [] Y = {1,2,3}; int i=0; for(int a:X) %3D if(a%2==1) { Y[i]=a; i++; else…
A: I have given an answer in step 2.
Q: 14. Give an example of program that calculate the following sum: n k ΣΣ ij i=0 j=0
A: //C program #include<stdio.h> int main(){ int n,k;//store n and k printf("enter n and…
Q: iii. Consider the expression T|F^ T. In how many ways can the expression be parenthesized so that…
A: Question iii. Consider the expression T | F ∧ T. In how many ways can the expression be…
Q: Python 3.7.4: Write a loop that reads positive integers from standard input and that terminates when…
A: Program Instructions:The sum is used to calculate the sum of the list.The check variable is used to…
Q: def f(x): print (x) X = 3.0 5.0 f(x) print (x) X%3D O 5, then 3 O 3, then 5 O 3, then 3 O 5, then 5
A: Given python code is def f(x) : print (x) x = 3.0x = 5.0f(x) print (x)
Q: 4. Write a program that takes data one line at a time and reverses the words of the line. For…
A: Source Code: #include<stdio.h>#include<string.h> /* Program that reverses the words in…
Q: What is the value stored in X[4] after the following code segment is executed? int X[5] = {5, 13,…
A: We are given a piece of code in C++ and we need to find the value of X[4] after execution of the…
Q: Assume x is equal to 4, In which of the following that y is not equal to 5 after execution? اختر…
A: Program execution in CPU A sequence of instructions is stored in memory.
Q: 11. Find the value of A[1] after execution of the following program. int[] A = {0,2,4,1,3}; for(int…
A: The answer is
Q: what sequence of numbers would be printed if the following function were executed with the value of…
A: The given code segment is: def xxx (N): print (N) if (N < 5): xxx (N + 2)…
Q: 16.Write a Java Applet program to display sum of two numbers. The numbers must be passed as…
A: An applet is a Java program that runs in a Web program.. Applets are intended to be implanted inside…
Q: Write a program whose input is a word or phrase, and that outputs whether the input is a palindrome.
A: 1. Input the string 2. Remove spaces from the input string 3. Reverse the string 4. If the reversed…
Q: int [] X = {12,15,12}; int [] Y = {1,2,3}; int i=0; for(int a:X) { if(a%2==1) { Y[i]=a; i++; } %3D
A: In the above question, we have to print the output of the given program. In this there are two…
Q: 10. I Love CCS by Jemar Jude Maranga Write a program that will take as input an integer n, and will…
A: We will use Java programming language for this question Algorithm: Ask user to input an integer…
Q: 6. Write a program in Python that will generate the following series using any looping statement: 4…
A: Through loop Iterating is done over a series (that is through a tuple, a list, a set, a dictionary…
Q: int [] X = {12,15,12}; int [] Y = {1,2,3}; int i=0; for (int a:X) { if(a%2==1) { Y[i]=a; i++; %D…
A: Explanation : initially i = 0, Y = { 1, 2, 3 } Now, iterating each element of x which is { 12,…
Q: 13 Write the output of the following code. int a=11,b=4,c=22; c=a < c || c < b && b == c;…
A: Given int a=11,b=4,c=22; c=a < c || c < b && b == c < has highest precedence among…
Q: 7. Write a program that accepts a sequence of positive integers and displays the difference between…
A: Sample Response: //C program to print the difference of sum of all even numbers and sum of all odd…
Q: 4.18 LAB: Exact change Write a program with total change amount as an integer input, and output the…
A: Given The answer is given below.
Q: C++ Write a program that flips a fair coin N times. It should calculate the number of times every…
A: Algorithm: Start the program. Read the number of flip from user. Generate the random flips. Count…
Q: The formula log(N) = log(No) +t/T log(2) can be used to simulate this, where Ng is the original…
A: Without VB net we can calulate the value of T: The symbolic value is given as: Syms : T Then use…
Q: 1. What will the following program print out: >>> x - 15 >>> x- x +5 print(*) >>> a. 20 b. 15 с. 5…
A: As given, we need to find out the output of the following code - x = 15 x = x + 5 print(x)
Q: 1. Consider the following code segment: for (int i = 200; i > 0; i /= 3) { } if (i % 2 == 0)…
A: Answer: Option C: 200 66 22 2
Q: The Fibonacci sequence is listed below: The first and second numbers both start at 1. After that,…
A: the Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... The next…
Q: 4. Using the machine language introduced in the class, write a program that multiplies the numbers…
A: program of multiplication of matricies:
Q: Python 3.7.4: The current calendar, called the Gregorian calendar, was introduced in 1582. Every…
A: Create three functions in the program first is taking input from a user, second is checking whether…
Q: b) The following code fragment passes data by reference. Convert it to the one that passes data by…
A: #include <bits/stdc++.h> using namespace std; void exponen(double num); // Declaration the…
Q: Python 3.7.4 The current calendar, called the Gregorian calendar, was introduced in 1582. Every year…
A: The following is the source code which takes the input from the user and tells whether the input…
Q: 18. int x,y; x = 1 / 2; y = 3.0 / 2.0 double z, w, t; z = 1 / 2; w = 3 / 2 t = 3.0 / 2.0%; x = y =…
A: We are two codes where we are initialising variable with some values. We will have to find their…
Q: Q3. a) Write a program to find the resultant (R) of two forces F1 & F2 with angle 0 between them as:…
A:
Q: 43) Review the given program below and answer the questions that follows. Vinclude int i, j; int…
A: answers:- 4.3 (a) the program is giving the sum of the first n natural numbers. example:- 3 is…
Q: 2. Series E by Jemar Jude Maranga Write a program that will print then items in the following…
A: I have written the correct code in C++ as an answer to this question in step 2. I have also provided…
Q: 5.Encipher the word GO by grouping. For conversion of the alphabet to numbers, use A B C D E F G H I…
A: Given message is GO This is a plain text and the values of letters present in the message are; G-6…
Q: 1. Write a program to compute and display the perimeter (P) and the area (A) of an ellipse. The…
A: ALGORITHM:- 1. Take input for a & b from user. 2. Calculate area and perimeter using that. 3.…
Q: C There is a road, the starting coordinate is 0, and the coordinatesof the line are given to draw a…
A: 1. Input the length 3.Calculate the total length 4.Calculate no of overlaps 5.Calculate max no of…
Q: 5.Encipher the word GO by grouping. For conversion of the alphabet to numbers, use A B C D E F G H I…
A: Solution::
Q: Python 3.7.4: Write a loop that reads positive integers from standard input and that terminates when…
A: Following is the program code that takes input from the user all positive integer and terminates if…
Q: 1. | Consider the following program: int a; s(n) { a = n; } p() { print a; } f() { s(1); p(); } g()…
A: The answer of this code is given below.
Q: Write a program with total change amount as an integer input, and output the change using the fewest…
A: CODE:- amount = int(input("Enter Amount: "))if amount<=0: print("No Change") else:…
Q: Consider the following lines of code: int a = 5; %3D double b = 10; double c = a / b; C (int)c +1;…
A: After the code have been executed,the value of c is 1.0. Therefore the correct option is None of the…
Q: 5 Write the result or output of the following program. M=5 N=2 P-M/N P-M//N P-P+N P-P+M print(“…
A: Given: M=5N=2P=M/NP=M//NP=P+NP=P+Mprint("First and second value of P is:" ,P,P)print("Third and…
Q: python #5 Write a program that selects all numbers from 1000 to 3000 (inclusive) in which every…
A: Consider one number at a time Check all the digits in number and if each digit is even then simply…
Q: Q#1) Write a program to get the table below as an output, use loops to print the output, the output…
A: Actually, program is a executable software that runs on a computer.
6.24
In Python,
Statistics are often calculated with varying amounts of input data. Write a program that takes any number of integers as input, and outputs the average and max.
Ex: If the input is:
15 20 0 5
the output is:
10 20
(Output needs to match exactly)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
- 4.16 In Python, Write a program whose input is two integers. Output the first integer and subsequent increments of 10 as long as the value is less than or equal to the second integer. Ex: If the input is: -15 30 the output is: -15 -5 5 15 25 Ex: If the second integer is less than the first as in: 20 5 the output is: Second integer can't be less than the first. For coding simplicity, output a space after every integer, including the last.4.17 In Python, Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text. Ex: If the input is: Hello there Hey quit then the output is: ereht olleH yeH4.16 In Python, Write a program whose input is two integers. Output the first integer and subsequent increments of 10 as long as the value is less than or equal to the second integer. Ex: If the input is: -15 30 the output is: -15 -5 5 15 25 (with the end starting a new line.) Ex: If the second integer is less than the first as in: 20 5 the output is: Second integer can't be less than the first. For coding simplicity, output a space after every integer, including the last. creating a new line at the end. (ex: 5 4 3 2 1 )
- Python 3.7.4: Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive. After the loop terminates, it prints out, on a line by itself, the sum of all the even integers read.Python 3.7.4: Write a loop that reads strings from standard input, where the string is either "duck" or "goose". The loop terminates when "goose" is read in. After the loop, your code should print out the number of "duck" strings that were read. ----------------- This is what I tried so far, and it's been marked wrong by MyProgrammingLab: count = 0inputstring=input("Enter goose/duck: ")countducks=0while inputstring!="duck": countducks+=1 inputstring=input("Enter either the word goose or duck: ")print(countducks, "This is the number of times duck was entered:" count)6.7 In Python, A palindrome is a word or a phrase that is the same when read both forward and backward. Examples are: "bob," "sees," or "never odd or even" (ignoring spaces). Write a program whose input is a word or phrase, and that outputs whether the input is a palindrome. Ex: If the input is: bob the output is: bob is a palindrome Ex: If the input is: bobby the output is: bobby is not a palindrome Hint: Start by removing spaces. Then check if a string is equivalent to it's reverse.
- 1. Provide a value we could put in the blank so that the value of x will be 7 after the code snippet. int x = _____;x = x % 15; A) 22 B) 15 C) 27 D) 86.24 In Python, Statistics are often calculated with varying amounts of input data. Write a program that takes any number of integers as input, and outputs the average and max. Ex: If the input is: 15 20 0 5 the output is: 10 20Python 3.7.4 The current calendar, called the Gregorian calendar, was introduced in 1582. Every year divisible by four was created to be a leap year, with the exception of the years ending in 00 (that is, those divisible by 100) and not divisible bye 400. For instance, the years 1600 and 2000 are leap years, but 1700, 1800 and 1900 are not. Write a program that requests a year as input and states whether it is a leap year. Make sure to use if/else statements. Example program:Enter a year: 20162016 is a leap year
- C++ Write a program that flips a fair coin N times. It should calculate the number of times every sequence of consecutive heads appears the sequence of N coin flips. Suppose the result of flipping the coin 10 times is HTHTTHHTTT then a sequence of 1 consecutive heads appears 2 times; a sequence of 2 consecutive heads appears 1 time. Note N is an arbitrarily large number.Python 3.7.4: Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive. After the loop terminates, it prints out, on a line by itself, the sum of all the even integers read. This is the first attempt, but it was marked wrong by MyProgrammingLab: ---------------------- Sum = 0 n=1 while(n>0): n = int(input("Enter positive integer ")) if (n < 0): break if(n%2==0): Sum+=nprint(Sum) ---------------------- MyProgrammingLab is stating that I should be using sum, True, and False.4 – A clothing store added a promotion which give 20% discount on t-shits if the total cost of purchased t-shirts is more than $1500.00. Assuming that each t-shirt costs $150.00, write a python program that asks user how many t-shirts he/she wants to purchase and print the total cost.