pays 100.00 during the first year and that yearly payment keeps on doubling. Display the year where yearly payment is grea
Q: Use C++ coding Write a program that calculates a student's GPA. Ask the user to enter grade and also…
A: The programming methodology for the program is given by: Including header files Main function…
Q: a and b are int variables containing values, and a > b. Write a for loop that prints numbers from a…
A: (Note: Student not mentioned specific programming language, hence it is written in C++) The…
Q: 1. Use a while loop to calculate factorial(10): f = 10 × 9 × 8 ×7 x 6 × 5 × 4 × 3 x 2 × 1
A: Kindly Note: As per our guidelines we are supposed to answer only one question when different…
Q: A. The main function should perform the following: • Initialize the variable NB with your section…
A: According to the Bartleby guideline, we are supposed to answer only one question at a time. Kindly…
Q: Java
A: The program declares two variables Parts and Chapters for user input. Parts take number of parts in…
Q: ***USE A LOOP!!!*** Write a program that uses a loop to calculate the first seven values of the…
A: We have to write a program using loop to calculate the first seven values of the Fabinacci number…
Q: Consider the following nested while loop a = 0 while a < 1000: b = 1 while b <= 1000: print(a,b) b =…
A: Please find the answer below :
Q: Q6: (Display patterns using loops) Use nested loops that display the following pattern in three…
A: Pattern A : Program in C #include <stdio.h> int main() { int i, j, rows; printf("Enter…
Q: a. while loop b. do-while loop c. for loop d. d. All of the above 3) Which of the loops iterates at…
A: while(condition) { statement(s); }If the condition will be true then it will run for ( init;…
Q: Q4 (B):- 1- If e is a variable initialized to 1,.. i many times will the following loop be executed?…
A: Given: How many times loop executed.
Q: QUESTION 10 The following loop displays int i = 1; while (i<= 10 ) { System.out.print(i++ + " ");…
A: Lets see the solution.
Q: Write a program that asks the user for a starting value and an ending value and then writes all the…
A: The while loop in the program iterate through all the values between s and e. The complete program…
Q: COUNTDOWN TO ZERO: 4 COUNTDOWN TO ZERO: 3 COUNTDOWN TO ZERO: 2 COUNTDOWN TO ZERO: 1 COUNTDOWN TO…
A: Algorithm:- Step1:- Start Step 2:- declare int n=4; step 3:- start a while loop and pass the…
Q: 2.Using a "For loop" function, create a program which stores your four favorite movies/anime an…
A: Algorithm: Start Read title and year of the 4 movies and store them 2 different arrays Using for…
Q: Convert the following code into a while loop. i = 1; for (i<10;i+=5) printf("the prize.");…
A: Here this for loop run until i is less than 10. each time it run it will print printf("the prize.");…
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: Design a VI in LabVIEW to display the sum of first 'n' numbers using for loop, e.g., if user enters…
A: here in this question we will develop program which will accept number from user and then it will…
Q: 1. Write a program that will read two values, a and b, and will print the quantity a+b and then loop…
A: As per our guidelines, we are supposed to answer only one question. Kindly repost the remaining…
Q: Rewrite the following while loop using a for loop. Assume the variables, x and c, have been declared…
A: Given: - Rewrite the below program with for loop
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 pseudo code for a program that uses while loop and: Takes 5 integers from user (both…
A: C++ Code: #include <iostream> #include <string> using namespace std; int main() { //…
Q: Write a while loop which prompts the user for the name of a drink and the cost. Add these new items…
A: Python used to answer this question
Q: Create a while loop to print the following set of characters: 100,98,96,...2
A: Note: Answering the question in python as no programming language is mentioned. Task : The task is…
Q: Implement the following: 1) Use a loop to print all the numbers of multiples of 6 and multiples of…
A: #include<iostream> using namespace std;int findSum(int a, int b){ int sum = 0; for (int…
Q: equest the lower bound, lower and the upper bound, upper from the console. b) Request an increment…
A: Using For loop lowerbound = int(input('\nEnter the lower Bound: ')) upperbound = int(input('Enter…
Q: Write a C++ (use cout and cin )program that calculates a student's GPA. Ask the user to enter grade…
A: Solution:
Q: 2. Write a program that uses a while loop to play a number guessing game. The computer should pick a…
A: As I have read the guidelines I can provide answers to only 3 parts of the questions in case of…
Q: Fix the errors in the loop shown in Figure 6-106. 41 Dim intStart As Integer = 8 42 43 Loop intStart…
A: Given: To Fix the errors in the given code.
Q: Write a For...Next loop that adds the odd numbers i through 49 and assigns their sum to the variable…
A: Below i have answered:
Q: Assignment 2: Write a program that input two integers N and M and out put M Hint: The student cannot…
A: Start. Read two input n and m. Pass this to the power(). Use for loop to multiply m, n times. Return…
Q: Using one of the loop structures, write function mypower(int x,int y) which calculates X". Then use…
A: myPower function should multiply x for y times to get the value of xy
Q: What's wrong? for (int k = 2, k <=12, k++) * O the increment should always be ++k the variable must…
A: for(int k=2, k<=12,++k); IN C++ The increment operator in for loop can pre increment (++k) as…
Q: 3. The following is a list of customers' annual scores. The company decided that to each customer…
A: According to the provided information: We need to create a program that can identify the customers…
Q: Print numbers 0, 1, 2, ..., userNum as shown, with each number indented by that number of spaces.…
A: The program is written in C++. Check the program screenshot for the correct indentation. Please…
Q: :* Write *3 code snippet each in python* that contains For loop, While loop and loop recursion. Copy…
A: Python provides different ways for executing the loops. While all the ways provide similar basic…
Q: 3. In a loop, compute and display the class average for a class of 10 students read grade values…
A: Below is the required code and sample output:
Q: Q2 Find the number of times the following loop is performed: LDI R20,20 BACK: LDI R21,$0A HERE: DEC…
A:
Q: a. Display the numbers from 1 to 15 b. Display the numbers from 5 to 15 c. Display every second…
A: As per Bartleby policy, I am allowed to answer only 1 question and maximum 3 subparts. I am…
Q: while loop, generate a random integer from 0 to 9. Use srand() only once. Keep track of the number…
A: Please find the answer below :
Q: Write a loop that displays all possible combinations of two letters where the letters are 'a', or…
A:
Q: • Prints on the screen your name, your student ID and your section number. For example, if your name…
A: We need to write a program for the given scenario. The language used is C++.
Q: Question#4.Convert the following for loop to while Loop: Convert the following for loop to a vhile…
A: Question 2 int x = 50; while(x>0) { System.outprintln(x + " seconds to go."); x--; }
Q: Using a FOR Loop, output your last name 25 times. Include a main heading on the Front Panel: MY LAST…
A: Since you haven't mentioned the programming language, we are answering this in C++. Program code:…
Q: The for loop at the top is converted into the while loop at the bottom. Identify what is wrong and…
A: Solution
Q: 2.Using a "For loop" function, create a program which stores your four favorite movies/anime and its…
A: As no programming language mentioned, using python. Below is the algorithm: Declare two lists for…
Q: a. int i = 2; while (i 8) int i = 2; break; while (i <= 4) } System.out.println (i++); d. int i 2;…
A: import java.util.*; public class Main { public static void main(String args[]) { for(int…
Q: Write a simple nested loop example that sums the even and odd numbers between 5 and 15 and prints…
A: I give the code in Python along with output and code screenshot
Q: A country club, which currently charges $3500 per year for membership, has announced it will…
A: Programming instructions: Declare the required variables. Use a loop that iterates 20 times. In the…
Q: create a C++ while loop that illustrates "how many shoes do you want?" but not greater than 10
A: Below is the complete solution with explanation for the given question in detail.
Q: What's wrong? for (int k =2, k<=12, k++) the increment should always be ++k B the commas should be…
A:
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
LOOP_B.C Suppose someone pays 100.00 during the first year and that yearly payment keeps on doubling. Display the year where yearly payment is greater than 50,000.00
Step by step
Solved in 2 steps with 1 images
- Birthday party At Lili's birthday party, there was a game arranged by Jojo as the host. That game is to distribute Y number of candy to X number of people where all the candy tastes sweet except for one last candy which tasted like rotten nuts. Candy distribution will be sequentially starting from position Z and if past the last position then the distribution of candy continues to the first position. Write down the person in which position will get the last candy. Input FormatThe first line of input is T, which is the number of test cases.The second row and the next number of T rows are X, Y, Z.X is the number of people to whom the candy will be distributed.Y is the number of candy available.Z is the starting position of the person to whom the candy will be distributed. Output FormatA string “Case #N: “ and a number representing the position of the person who got the last candy. Constraints1 ≤ T ≤ 1001 ≤ X, Y ≤ 1031 ≤ Z ≤ X Sample Input 43 4 13 5 24 2 24 5 2 Sample OutputCase #1: 1Case…Assignment Write a program that tracks how much book pages the user reads in total in a day and reports if the daily target is reached or not. The program will keep reading int values, each representing pages read during an individual session within a day (pagesRead) until either the user enters 0 or the daily target of 125 pages is met. If the user enters 0, the program should print the remaining pages to the daily target as an int. Otherwise, the program should notify the user has reached the daily target by printing the text "Target is reached in", followed by the number of sessions given as an int, and finally printing the text " session(s)". NOTE: You MUST use a repetitive statement in this question. NOTE: Each pages Read value MAY also be given as a negative value. These values should simply be skipped without affecting session count. Input 40 20 Output 65 34 56 5 12 67 5.67-5 53 Target is reached in Target is reached in 3 5 session(s) session(s)Q1/ Write a program that reads from the user the number of students in the class and their grades in one class, the program must find the largest and the lowest grades with the sequence of students and then find the average grade of the class, see the example below: N is the numbers of students in one class X is the grade for each student in the class For example Student # 1 = 89 Student # 2= 60 Student # =80 You must find the largest and the lowest grades with the sequence of the student. The largest grade is 89 the student's number is 1 The lowest grade is 60 the student's number is 2 The average grade of the class is 76.333
- compare loans with various interest rates) Write a programthat lets the user enter the loan amount and loan period in number of years anddisplays the monthly and total payments for each interest rate starting from 5% to10%, with an increment of 1/4. Here is a sample run: Loan Amount: 10000Number of Years: 5Interest Rate Monthly Payment Total Payment5.000% 188.71 11322.745.250% 189.86 11391.595.500% 191.01 11460.70...9.750% 211.24 12674.5510.000% 212.47 12748.23Python Assignment: In India McDonald's has the n number of customers and they are famous for their taste and quality so they plan to Organise the challenge for foody people. What is the challenge is?| you have taken a food challenge from the Chef and now you have to eat directly the Y burgers. You will eat as follows: At the first minute you will eat exactly the X burgers and every minute after that you will eat twice the number of burgers you ate the minute before. As you can get tired of food, Chef also lets you take a break from eating for one minute. When you start eating again after a break, your food streaks are reset, which means that in the first minute after the break you will eat X burgers and every minute after that you will eat the burgers you ate twice the last minute. Allow a1, a2, ., let it be your meal length in minutes. The cook needs to have all the ai different in pairs. Get the minimum number of minutes you need to eat Y burgers directly or decide that it is not…You need to write a loop that will repeat exactly 125 times. Which is the preferred loop construct to use? A. while B. do while loop C. for loop
- 15. Speed Conversion ChartYour friend Amanda, who lives in the United States, just bought an antique European sports car. The car’s speedometer works in kilometers per hour. The formulafor converting kilometers per hour to miles per hour is:MPH = KPH * 0.6214In the formula, MPH is the speed in miles per hour and KPH is the speed in kilometersper hour. Amanda is afraid she will get a speeding ticket, and has asked you to write aprogram that displays a list of speeds in kilometers per hour with their values convertedto miles per hour. The list should display the speeds from 60 kilometers per hourthrough 130 kilometers per hour, in increments of 5 kilometers per hour. (In otherwords, it should display 60 kph, 65 kph, 70 kph, and so forth, up through 130 kph.) made in visual studio 2017Question#2. The distance a vehicle travels can be calculated as fallout: Distance = Speed * Time For example, if a train travels 60 miles-per-hour for three hours, the distance [raveled is 120 miles. Write a program that asks for the speed of a vehicle (in miles-per-hour) and the number of hours it has traveled. It should use a loop to display the distance a vehicle has traveled for each hour of a time period specified by the user. For example, if a vehicle is traveling at 40 mph far a three-hour time period, it should display a report similar to the one chat follows: Hour Distance Traveled 1 90 2 100 3 150 Input Validation: Do not accept a negative number for speed and do not accept any value les than 1 for time traveled.0199% 10:00 docs.google.com/forms 13 last constant Problem 1 At a certain university, students have to submit their exams online. The administration decides that for each minute of late submission, 5 points are deducted. Write a program that asks the user for his initial grade and how long he delayed in submitting, and then displays the final result. Sample Run 1: Enter your initial grade: 82 Enter the late submission time (in minutes) : 6 Your final grade is 52 Sample Run 2: Enter your initial grade: 115 Grades should be between 0 and 100 Sample Run 3: Enter your initial grade: 43 Enter the late submission time (in minutes): 10 Your final grade is 0 Sample Run 4: Enter your initial grade: 72 Enter the late submission time (in minutes) : -2 Time should be positive Your answer Problem 2 Write a Java program integers day. month, and vear. You are NOT required to check if the values entered by the user are in give the user the ability to determine the day of a given date. The user shall…
- Assignment Write a program that tracks how much steps the user walks in total in a day and reports if the daily target is reached or not. The program will keep reading double values, each representing steps walked during an individual activity within a day (stepsWalked) until either the user enters a negative value or the daily target of 5000 steps is met. If the user enters a negative number, the program should print total steps walked as a double. Otherwise, if the target is exactly reached, the program should simply print "Target is reached", finally if the target is surpassed the program should print the text "Target is surpassed by", followed by the excess amount above the target as a double, and finally printing the text "steps". NOTE: You MUST use a repetitive statement in this question. NOTE: Each stepsWalked value will be given as a non-negative value. You do NOT need to check this. Input Output Answer assignment 3000 1300 500 2305.2 Target is surpassed by 2105.2 steps 450…For this assignment you will: write an algorithm code it in Python Tuition Fees Increase In 2008, BC charged $115 per credit for a course. BC announced it would increase its cost per credit by 4% each year for the next five years. Write a program that uses a for loop to display the projected rates for the next five years as follows: Year Cost per Credit -------------------------- 2008 $115.00 2009 $119.60 2010 $124.38 2011 $129.36 2012 $134.53 2013 $139.92 ============================================================================ Pay attention to the spacing/alignment in your output. Review the Formatting Output in Python documentation in order to properly format the numerical values in your output. The output should present with two decimal places.Class Exercise Write a program that asks the user to enter how many students they have. Use a for loop to iterate through each student. For each student, allow the user to enter as many scores as they want and let them know that entering -1 will indicate the end of entering scores (note: use a while loop with sentinel value). Sum all the scores for each student and display the total on the screen. For example: Student 1 Total score is 340 Student 2 Total score is 200