5. Write a program using for loop to find the average mark of the class. The expected output is as shown in the output console: OUTPUT CONSOLE Please insert number of students: 5 Please insert Student 1's mark: 20 Please insert Student 2's mark: 100 Please insert Student 3's mark: 0 Please insert Student 4's mark: 70 Please insert Student 5's mark: 70 The average mark of the class is 52.00
Q: Write a for loop to print each contact in contact_emails. Sample output with inputs: 'Alf'…
A: For loop to print each of the contact in contact_emails for x,y in contact_emails.items():…
Q: OUTPUT CONSOLE Please insert number of students: 5 Please insert Student 1's mark: 20 Please insert…
A: Input : Input marks Output : Average marks of students.
Q: Write a while loop that prints userNum divided by 2 (integer division) until reaching 1. Follow each…
A: This program can be implemented using a while loop in JAVA, here is the code and output attached.
Q: In Python: Write a for loop to print each contact in contact_emails. Sample output with inputs:…
A: The easiest way to do this would be utilizing the for/in loops to iterate through each key and for…
Q: Write a program that draws an output by using a character 'X' as examples below. The number of the…
A: nested for loop and and while loop is used to solve this problem.
Q: Write a program with a loop that lets the user enter a series of integers. The user shouldenter −99…
A: Given : Write a program with a loop that lets the user enter a series of integers. The user should…
Q: Construct a while() loop in programming language c, which prints only the even integer numbers in…
A: while(n>=2) { if(n%2==0) { printf("%d\n",n); n=n-2;…
Q: Loops, C++ Write a program whose input is two integers, and whose output is the first integer and…
A: I give the code in C++ along with output and code screenshots
Q: Write a program that can calculate the class average for a number of students. The user should be…
A: Code: grades = [] while True: grade = int(input('\nEnter grade, -1 to end: ')) if (grade == -1 ):…
Q: Write a loop to request integer values from the console until an even value is entered.
A: While doing programming in any programming language, you need to use various variables to store…
Q: Write a program using for loop to find the average mark of the class. The expected output is as…
A: - We are going to calculate the average marks of the students. - We are using C++ here.
Q: Implement the following: Write a loop that prints out the following numbers. Make sure to precisely…
A: Since you have not mentioned the programming language in which you need this to be done. so i have…
Q: After the break statement is executed in the following loop, which statement is execute d? Display…
A: As it given in the if block that the whenever the multiply of i and j results is greater than 2 it…
Q: This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The…
A: Here have to determine c++ code to print pattern.
Q: Write a program that calculates the balance of a savings account at the end of a period of time. It…
A: C++ program calculates the balance of a savings account at the end of a period of time. It should…
Q: Write a for loop to print each contact in contact_emails. Sample output with inputs: 'Alf'…
A: The problem is based on the basics of dictionary data structure in python programming language.
Q: 5. Write a program that will evaluate 1 y(x)=In 1-x Use a while loop so that the program will repeat…
A: x = input('Input the value of x : ');if(x<1) y = log(1./(1-x)); disp('Calculated value is…
Q: a. Write a program to input two integer values a and b, calculate and display the values of s and t…
A: #include <stdio.h>#include <stdlib.h>#include<math.h>int main(){ double a=0;…
Q: Write a program that asks the user for two integers; assume the second integer is larger than the…
A: Since no programming language is mentioned, I am using python Algorithm: Start Read 2 numbers…
Q: Write a while loop that prints userNum divided by 2 (integer division) until reaching 1. Follow each…
A: Step 1 : Start Step 2 : Take input for the userNum from the user using the scanner object. Step 3 :…
Q: Write a program that asks the user for the price of several items sold until the user answers with…
A: The answer is in below steps:
Q: What is the exact output of the following nested for loop? for (int row = 1; row < 10; row…
A: PROGRAM: public class Main { public static void main(String[] args) { for (int…
Q: Write a program that takes in an integer in the range 11-100 as input. The output is a countdown…
A: Note: Programming language is not mentioned we are providing answer in C and Coral language.
Q: a) Correct the code to print the following: 0 1 2 3 4 5 6 7 8 9 b) then rewrite the code with…
A: Start Run loop 0 to lenth-1 Assign Values to the array endloop Run loop 0 to lenth-1 print the array…
Q: Write a for loop to print each contact in contact_emails. Sample output with inputs: 'Alf'…
A: Below is the required answer:
Q: Write a program that asks the user for words until the user enters a blank line, which is a return…
A: logic:- used while True to iterate till break is not encountered. Used list to append string used…
Q: Write a program that prompts for the number of rows and then uses nested loops to print the output…
A: Given : Write a program that prompts for the number of rows and then uses nested loops to print…
Q: Write a program that runs like a cashier in a store. The program should use a while loop and prompt…
A: Program code: #variable declaration loopCashier = True itemCount = 0 finalAmount = 0 # Looping the…
Q: Write a program that uses a loop to display Pattern A below, followed by another loop that displays…
A: Given: To write a program to print two given patterns side by side.
Q: Question 3 Write a program using a "while loop" to continuously read the grade from the student…
A: 1 – switch: The “switch” statement is followed by a block of statements. A block of statements is a…
Q: Write a loop that prints each country's population in country_pop. Sample output with input:…
A: Program in python: country_pop={"United States" : 318463000,…
Q: Write a do while loop that writes the numbers from 10 to 100 that are even and multiple of 8. The…
A: Required: Write a do while loop that writes the numbers from 10 to 100 that are even and multiple of…
Q: By using while loop OR do..while loop, write a program that displays a list of groceries. Then,…
A: Programming language is missing in the question. So we will answer this program in C++ language. If…
Q: In C, Write a loop that reads positive integers from standard input and that terminates when it…
A: The C program and its approach are given below: - Approach: - Importing the header file. Defining…
Q: Given positive integer num_insects, write a while loop that prints, then doubles, num_insects each…
A: You may have encountered this error: File "main.py", line 4 print(num_insects, end= ' ')…
Q: OUTPUT CONSOLE Please insert number of students: 5 Please insert Student l's mark: 20 Please insert…
A: Note: Answering the question in python as no programming language is mentioned. Input : Input…
Q: Write a program that creates three 2-digits addition questions for the second grade students. 1. If…
A: A required C++ program is as follows, #include<iostream> #include<ctime>…
Q: Given the following code segment with the enhanced for loop: int [] numbers = {6, 8, 9, 5}; for (int…
A: In the above-given program code: An array is declared with some predefined variables. By using the…
Q: Write a program that uses a for loop to display a table that lists in one column values for ounces,…
A: - We have to code for printing the table for ounces, pints, quartz and litres.
Q: Write a for loop that prints from startNumber to finalNumber. Ex: startNumber = -3 and finalNumber =…
A: The program is written in C++ #include <iostream> using namespace std; int main(){ int…
Q: Write a program that prompts the user to enter two positive integers. Implement a function to…
A:
Q: Write a FUNCTION that asks the user to input a string. Unless the user inputs "END" or "end", a loop…
A: To find the letters and numbers in the string, we need to check the each character for the alphabets…
Q: Given an int variable n that has already been declared and initialized to a positive value, and…
A: As No coding language is provided giving the code in c++: #include <iostream>using namespace…
Q: Write a program that takes in an integer in the range 11-100 as input. The output is a countdown…
A: x = int(input("Enter number between 11 to 100:")) if x>=11: count = 11 while count<=100:…
Q: An electrical manufacturer test five generators by measuring their output voltages at three at three…
A: Given: An electrical manufacturer test five generators by measuring their output voltages at three…
Q: Write a program to read student ID and check whether it is odd/even number. Output a 4X4 badge if…
A: Note - As you haven't mentioned specific programming language to write code in, I have written the…
Q: For python Write a for loop to print each contact in contact_emails. Sample output with inputs:…
A: contact_emails = {'Sue Reyn' : 's.reyn@email.com','Mike Filt': 'mike.filt@bmail.com','Nate Arty':…
Q: Write a loop that counts and outputs the number of odd integers in the range 25 (exclusive) to 125…
A: Java used to answer this question
Q: Write a program that calculates the equivalent resistance of a circuit. n electrical resistors with…
A: NOTE: - The program is implemented in the C language. EXPLANATION: - Integer[] of resistance to…
Q: Write a program using for loop that generates a multiplication table for any integer (given by the…
A: Given :- Write a program using for loop that generates a multiplication table for any integer…
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
- Write a for loop to print each contact in contact_emails.Sample output with inputs: 'Alf' 'alf1@hmail.com' mike.filt@bmail.com is Mike Filt s.reyn@email.com is Sue Reyn narty042@nmail.com is Nate Arty alf1@hmail.com is Alf python contact_emails = { 'Sue Reyn' : 's.reyn@email.com', 'Mike Filt': 'mike.filt@bmail.com', 'Nate Arty': 'narty042@nmail.com'} new_contact = input()new_email = input()contact_emails[new_contact] = new_email ''' Your solution goes here '''Write a for loop to print each contact in contact_emails.Sample output with inputs: 'Alf' 'alf1@hmail.com' mike.filt@bmail.com is Mike Filt s.reyn@email.com is Sue Reyn narty042@nmail.com is Nate Arty alf1@hmail.com is Alf contact_emails = {'Sue Reyn' : 's.reyn@email.com','Mike Filt': 'mike.filt@bmail.com','Nate Arty': 'narty042@nmail.com'} new_contact = input()new_email = input()contact_emails[new_contact] = new_email ''' Your solution goes here '''1- Write a program that can calculate the class average for a number of students. The user should be able to enter the grades, use sentinel-controlled repetition to manage input. (python) Sample Output: Enter grade, -1 to end: 75 Enter grade, -1 to end: 94 Enter grade, -1 to end: 97 Enter grade, -1 to end: 88 Enter grade, -1 to end: 70 Enter grade, -1 to end: 64 Enter grade, -1 to end: 83 Enter grade, -1 to end: 89 Enter grade, -1 to end: -1 class average is 82.5 2- Write a program that reads in two integers and determines and prints whether the first is a multiple of the second. (Hint: Use the modulus operator.
- Question 2: Write a program to read student ID and check whether it is odd/even number. Output a 4X4 badge if the student ID is even number and output a 3X3 badge if it is odd number. The badge is built up by the (height X width) of asterisks. (Use for-loop to draw the asterisks, do not hard-coded)Write a while loop that multiplies userNum by 3, assigns userNum with the product, and outputs the updated userNum, followed by a newline. The loop iterates until userNum is greater than or equal to 18. C++ Ex: If input is 4, then the output is: 12 36 1 2 3 4 5 6 7 8 9 10 11 12 #include <iostream> using namespace std; int main() { intuserNum; cin>>userNum; /* Your code goes here */ return0; }C++ Write a program that outputs a downwards facing arrow composed of a rectangle and a right triangle. Arrow dimensions are defined by user specified arrow base height, arrow base width, and arrow head width. Input the arrow base height (int) and width (int). Draw a rectangle using asterisks (height x width). Hint: use a nested loop in which the inner loop draws one row of *s, and the outer loop iterates a number of times equal to the height. Submit for grading to confirm two tests pass. Ex: If input is: 6 4 Sample output is: **** **** **** **** **** ****
- An electrical manufacturer test five generators by measuring their output voltages at three at three different times. Write a C++ program that uses a nested loop to enter each generator’s test results and then computes and displays the average voltage for each generator. Finally, compute for the total average for all generators. Assume the following generator test results. 1st generator 122.5 122.7 123.0 2nd generator 120.2 127.0 125.1 3rd generator 121.7 124.9 126.0 4th generator 122.9 123.8 126.7 5th generator 121.5 124.7 122.6This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by user specified arrow base height, arrow base width, and arrow head width. (1) Modify the given program to use a loop to output an arrow base of height arrowBaseHeight. (1 pt) (2) Modify the given program to use a loop to output an arrow base of width arrowBaseWidth. Use a nested loop in which the inner loop draws the *’s, and the outer loop iterates a number of times equal to the height of the arrow base. (1 pt) (3) Modify the given program to use a loop to output an arrow head of width arrowHeadWidth. Use a nested loop in which the inner loop draws the *’s, and the outer loop iterates a number of times equal to the height of the arrow head. (2 pts) (4) Modify the given program to only accept an arrow head width that is larger than the arrow base width. Use a loop to continue prompting the user for an arrow head width until the value is larger than the…Write a program that creates the multi-panel plot shown below, for Planck curves at 4 different temperatures Planck Curves Use embedded noninteractive plotting and set the figure size to be 10x5 inches. • You may write your program in a single cell, or break it over multiple cells. Use a logarithmic x axes, and the logspace() function for generating the axes values. You will have to be careful with units on this one. For 50% extra credit have your program use a loop over the four axes, with all the plotting code contained within the loop (except for any subplot adjustments). 0.030 12 300K 1000K 0.025 10 0.020 FBBX (Wm-nm-1) FBBA (Wm-2nm-¹) 0.015 10 0.010 0.005 2 0.000 A (nm) λ (nm) 100000 3000 3000K 6000K 2500 80000 2000 60000 FBBA (Wm-2nm-¹) FBBX (Wm-2nm-1) 1500 40000 1000 20000 500 0 101 102 0 101 103 104 105 106 102 103 104 105 106 X (nm) λ (nm) python language
- Question B. Write a C++ program that reads the marks of a group of students from a text file "grades.txt" and computes the average of all grades. The program must check the file for any opening problems, and then proceeds to do the other tasks. The input file can have 1 or more students. The text file and sample-output are shown as below: O grades - Notepad File Edit Format View Help 60.0 78.6 78.0 98.6 77.7 55.0 73.0 80.7 80.0 85.0 Windows (CF Ln 13, Col 1 100% CAUsers\Imran\Desktop\Lab111\Debug\Lab111.exe Average of 10 students is 77 Press any key to continue... Activa Coto sWrite a program that uses a for loop and the range function to generate a table of areas and circumferences of 10 circles with radii from 10 to 100 in increments of 10. See Required Output below. The radii should display centered in a column 10 characters wide with 1 decimal place. The areas should be centered in a column 14 characters wide with 4 decimals and the circumferences should be centered in a column 18 characters wide with 3 decimals. For full points, include centered column headings as shown. I also need pseudocode. Thanks so much!What is the output of the following codes, consider each case independently? What will be the value of x after the following loop is executed? x = 0 For i = 1 To 2 For j = 1 To 3 x = x * i * j Next j Next i