Write a program sequence.cc that prompts the user to enter the value of x, the pro- gram outputs the integer k such that ak = 1, the numbers a0, a1, a2, ..., ak, the largest number of the sequence a0, a1, a2, ..., ak, and the position of the largest number in the sequence.
Q: Write a program that prompts the user to input any digit then swap the position of the first and the…
A: #include <iostream>#include <string.h>using namespace std; int main(){ string number;…
Q: Write a program that reads integers between 1 and 100 and counts the occurrences of each. Assume the…
A: The question is to write the code for the given problem. As here no language has been mentioned Java…
Q: Write a program that prompts the user to enter two integer numbers x and y. The program must check…
A: Since , their is no any specific language is mentioned for writing a program so program is written…
Q: Write a program that prompts the user to enter two positive integers less than 1,000,000,000 and the…
A: Program code: //include the required header files #include <iostream> using namespace std;…
Q: QUESTION#5: Write a program that inputs a sequence of non-negative numbers terminated by a negative…
A: Declare an array to store the given input Append the negative number at the end of each list Compute…
Q: Write a program that inputs year and month number, it then display the number of days in that month…
A: The given problem is to be solved in programming language where the user will input the year and…
Q: Write program to print "OK" if the number is even and greater than 100 or the number is even and…
A: Conditional statement: A programming language allows to test or check the condition to control the…
Q: Write a complete program that: 1. Prompts the user to enter an integer and reads in an integer…
A: CODE:- #include <iostream>using namespace std;int main(){ int f, s, sum , sub , divi ,…
Q: Write a program that take input a value x from user and print the value 2*x*sin2x
A: Note- Since programming language is not mentioned so I have used C programming language. To…
Q: Write a program that accepts a number corresponding to a plane figure: 1. Right Triangle 2.…
A: import math choice = int(input("1. Right Triangle \n2. Rectangle \n3. Circle\n")) if choice == 1:…
Q: Write a program to read a positive integer value less than 100 that represents the number of cents,…
A: #include <iostream> using namespace std; int main(){ int amt,quaters,dimes,nickels,pennies;…
Q: In this exercise you will create a program that reads a letter of the alphabet from the user. If the…
A: In this program Get the input alphabetical letter from the user Using if statement check the entered…
Q: 2. Write a program to determine the price for a portrait sitting. The price is determined by…
A: Program to determine the price for a portrait sitting: #include <bits/stdc++.h> using…
Q: Write a program that prompts the user to enter an integer and determines it is divisIble by and 6,…
A: Q1: #include<bits/stdc++.h> using namespace std; int main() { cout<<"Enter a…
Q: Write a program, which: inputs 50 numbers outputs how many of the numbers were > 100 langiage C#
A: #include <stdio.h> int main(){ int x, i, sum=0; x=0; int A[50]; printf("Input 50…
Q: write a program to print the name of day when entering the number of the day. (For example, when the…
A: read a value convert it into int using Integer.Parse() if x=1 then display “sunday” else if x=2 then…
Q: Write a program that input miles from the user and convert miles into kilometres. One mile is equal…
A: Data types in C++: Some of the basic datatypes of C++ are: int float double char wchar_t bool void
Q: Your relative, who goes to primary school and has just learned the multiplication table, asks you to…
A: using System; public class Multiplication { public static void main() { int i,n,count=0;…
Q: Write a program that prompts the user to enter the month and first day of the month, and displays…
A: /*program that prompts the user to enter the month and first day of the month, and displays all the…
Q: Write a program that prompts the user to input an integer and then outputs both individual digits of…
A: Note: In this question, the coding language is not specified then we are doing this question in the…
Q: Create a program that reads two integers, a and b, from the user. Your program should compute and…
A: #asking user for inputa=int(input("Enter a number "))b=int(input("Enter a number "))#find…
Q: Write a program that converts U.S. dollars toCanadian dollars, German marks, and British pounds, as…
A: Program: import java.text.NumberFormat; import java.util.Locale; import…
Q: Write a program that prompts the user to enter the year and first day of the year, and displays the…
A: PROGRAM CODE: import java.util.*;public class Main { public static void main(String[] strings)…
Q: Write a program that prompts the user to input three numbers. The program should then output the…
A: The given is the requirement to solve the problem in C++ programming lanague where: a) User will…
Q: Write a program that prompts the user to input three numbers. The program should then output the…
A: #include<iostream> #include<algorithm> using namespace std; int main(){ cout…
Q: Write a program using inputs age (years), weight (pounds), heart rate (beats per minute), and time…
A: Note: As no language is mentioned, therefore answering the given question in python. Input : age…
Q: Write a program that reads from the user the initial Kilometers of the car, the current Kilometers…
A: Java program for the above fuel consumption problem is given below in step 2.
Q: Write a program that prompts the user to input three (3) integers: MM, DD, and YYYY. For example, 07…
A: Introduction: Here we are required to create a program that tells us the difference between the 1st…
Q: Write a program which takes an input from the user, if the input is 1, calculate the area of the…
A: Since you have not mentioned the programming language. I will attempt it in python. if you need this…
Q: Given a string that contains text. Print all words starting with the letter that the user enters.…
A: Required: Given a string that contains text. Print all words starting with the letter that the…
Q: prompts the user to input an integer between 1 and 36. If the number is less than or equal to 10,…
A: the code is an given below :
Q: Write a program that prompts the user to enter aletter grade A, B, C, D, or F and displays its…
A: Program code: //import the required packages import java.util.Scanner; //define a class public…
Q: Write a program that reads from the user the product unit price, tax percentage to be applied on the…
A: Given: write the program using java
Q: WRITE A PROGRAM TO CALCULATRE THE AREA OF A RECTANGLE OF LENGTH =5 CM AND BREADTH=8CM. CALCULATE THE…
A: Hey, thank you for your question. There are multiple subparts submitted to your question. As per our…
Q: Write a program that prompts the user to input three (3) integers: MM, DD, and YYYY. For example, 07…
A: python program to number of days elapsed from 01 January of that year
Q: program that prompts the user to enter an integer. If the number is a multiple of 5, print HiFive.…
A: As programming language is not mentioned, so we are providing answer in C++ language.
Q: Write a program that takes in a positive integer as input representing the number of employees, then…
A: We plan to use a Language Understanding container for an application that we previously exported. We…
Q: Write a program whose input is two integers. Output the first integer and subsequent increments of 5…
A: Please Indent the code as shown in the picture below :
Q: Write a program that reads the subtotal and the gratuity rate and computes the gratuity and total.…
A: GIVEN: Write a program that reads the subtotal and the gratuity rate and computes the gratuity and…
Q: Write a program that prompts the user to enter the number of students and each student's name and…
A: Python code to copy:- n = int(input("Enter the number of students: "))name1 = input("Enter a student…
Q: Write a program to have the user guess a number stored in the program. If he guesses right, tell him…
A: While doing programming in any programming language, you need to use various variables to store…
Q: C++) Write a program with total change amount as an integer input, and output the change using the…
A: /*Write a program with total change amount as an integer input that outputs the change using the…
Q: Write a program that prompt the user to enter the number of students and each student's score, and…
A: #include <iostream>using namespace std; struct student{ char name[50]; float marks;}…
Q: Write a program that prompts the user to enter the exchange rate from currency in U.S. dollars to…
A: Write a program that prompts the user to enter the exchange rate from currency in U.S. dollars to…
Q: Write a program that outputs all possibilities to put + or - or nothing between the numbers 1,2,…,9…
A: NOTE - I have used the Python programming language. Here we have to use 3 different operands which…
Q: Write a program that converts an input inch(es) into its equivalent centimeters.
A: here in this question we have asked to write a program that convert inches to centimeter.
Q: Write a program that reads from the user the initial Kilometers of the car, the current Kilometers…
A: Required: Write a program that reads from the user the initial Kilometers of the car, the current…
Q: Write a program that prompts the user to enter two integer numbers A and B. The program must check…
A: Using if else and for loops we can solve this problem.
Write a program sequence.cc that prompts the user to enter the value of x, the pro- gram outputs the integer k such that ak = 1, the numbers a0, a1, a2, ..., ak, the largest number of the sequence a0, a1, a2, ..., ak, and the position of the largest number in the sequence.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- In Python Write a program that computes the fuel efficiency for a multi-leg journey. The program will first prompt for the starting odometer reading and then get information about a series of legs. For each leg, the user enters the current odometer reading and the amount of gas used (separated by a space). The user signals the end of the trip with a blank line. The program should print the miles per gallon achieved on each leg and the total MPG for the tripAirline companies apply baggage restrictions for their passengers. An airline company has decided to apply a 10kg limitation for passengers' hand luggage and 20kg for their normal baggage. When passengers arrive, they enter their hand and normal luggage weight from the keyboard. If passengers exceed their normal baggage allowance of 10 dollars per gram, they pay 12 dollars per kg. Accordingly, write the program that calculates the baggage price of the airline they will go to according to the baggage values entered by the arriving passenger and keeps this from closing the program for each passenger. Note: If hand and normal baggage allowances are stretched below the maximum value, the payment amount will be considered not negative. An example printout is given on the right. Geri bildirim gönderA 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.
- Coral Help Write a program that takes a date as input and outputs the date's season. The input is an integer to represent the month and an integer to represent the day. Ex: If the input is: 4 11 the output is: spring In addition, check if both integers are valid (an actual month and day). Ex: If the input is: 14 65 the output is: invalid The dates for each season are:spring: March 20 - June 20summer: June 21 - September 21autumn: September 22 - December 20winter: December 21 - March 19the electrical resistance r (in ohms) of a metal wire is given by the formula r = (ml)/ a where m is the resistivity of the metal; l is the lenght of the wire in feer, and a is the cross-sectional area of the wire ( in the circular mils) write a program that allow user to input for l and a for a copper whose resistivity m of copper is 10.4. Calculte the resistance of a wire] In a triangle, the sum of the lengths of any two sides is greater than the lengthof the other third side. Write a program triangle.cc that prompts a user to enterthe lengths of three sides, checks if they form a triangle, and outputs if it is an isosceles,equilateral, scalene, or right triangle. Also, your program should output the perimeter andthe area of the triangle. In a right triangle, the square of the length of one side is equalto the sum of the squares of the lengths of the other two sides. An isosceles triangle hastwo sides of equal length. An equilateral triangle has all three sides with the same length.A scalene triangle has no equal sides. Your program should define and use the followingfunctions:(a) isTriangle - takes the 3 sides of a triangle and returns true if they form a triangle,false otherwise.(b) isIsosceles - takes the 3 sides of a triangle and returns true if they form anisosceles triangle, false otherwise.(c) isEquilateral - takes the 3 sides of a triangle and…
- 1. Write a program that asks the user for the price of several items sold until the user answers with an “N”. The program should accumulate the total of all prices entered. After the loop is finished, the program is to compute the sales tax of all items as 7% [0.07]. Finally, the program is to print out the total of the items, the sales tax due, and the total amount due on three separate lines.Three numbersa. Write a program that reads three numbers and prints “all the same” if they are allthe same, “all different” if they are all different, and “neither” otherwise.b. Write a program that reads three numbers and prints “increasing” if they are inincreasing order, “decreasing” if they are in decreasing order, and “neither”otherwise. Here, “increasing” means “strictly increasing”, with each value largerthan its predecessor. The sequence 3 4 4 would not be considered increasing.c. Repeat part b. but before reading the numbers, ask the user whetherincreasing/decreasing should be “strict” or “lenient”. In lenient mode, thesequence 3 4 4 is increasing and the sequence 4 4 4 is both increasing anddecreasingf. 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.…
- 6. A palindrome is a number or text phrase that reads the same backwards or forwards. For example, each of the following five-digit integers is a palindrome: 12321, 55555, 45554 and 11611. Write a program that reads a 5 digit integer and determines whether it is a palindrome. Hint: One way to do this is to use division (/) and modulus (%) operators to separate the number into individual digits.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 characterUSE PYTHON A small shop sells 280 different items. Each item is identified by a 3 – digit code. All items that start with a zero (0) are cards, All items that start with a one (1) are sweets, All items that start with a two (2) are stationery and All items that start with a three (3) are toys. Write a program which inputs the 3 – digit code for all 280 items and outputs the number of cards, sweets, stationery and toys.