int a-5, b-3,c; c=a/b; printf("input a printf("input b: ");scanf ("&d", &b); printf("Result of operation a and b is %d" ,c); :"): scanf ("&d",&a); If the user inputs a =9 and b 3, the output c of the above program is !! 02 1.667 3.
Q: Write a function that converts milliseconds to hours, minutes, and seconds using the following…
A: Steps to convert milliseconds to seconds, minutes, and hours as follows Total seconds = Milli…
Q: 20. or the following code if x = 2: print ('Two or more) else : print (Something else) What value of…
A: We are given a code snippet and we will compare values of x, and statements will be printed…
Q: Write a program to input for a number, if the number is palindrome, then display its half on the…
A: Note: In this question, the coding language is not specified then we are doing this question in the…
Q: Calories = ( (Age x 0.2757) + (Weight x 0.03295) + (Heart Rate x 1.0781) — 75.4991 ) x Time / 8.368…
A: The steps of the program are: Take input for the variables age, weight, heart_rate, time using the…
Q: Modify the following program so it can add two numbers between the values 0 and 9. The current…
A: The working program is written in the second step
Q: Task 1: Create a program that accepts a number and determine the factor of the number. Display the…
A: Here our task is to write a C++ program that accepts a number as input and determine the factor of…
Q: Write a program to: (C++ Language) Develop a program to convert a number of seconds into hours,…
A: Introduction of the Program: The C++ program takes total seconds as input from the user then the…
Q: Write a program that asks user to enter a number until user enters -1. Then the program should…
A: Since you have not mentioned programming language I'm doing this in c++.
Q: input the source code (code1)to the program below(code 2), make sure the program can run with these…
A: The code has been placed at its required place.
Q: 1. Write a program that prompts the user to enter two points (x1, yl) and (x2, y2) and displays…
A: Here I have taken input from the user and then stored it into 4 different variables. Next, I have…
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both…
A: PROGRAM: //Importing the required header file import java.util.Scanner; //Defining the class…
Q: Referring to the program below, predict the 'printf' output after program execution. #include void…
A:
Q: 1. Write a program that reads an integer from the user. Then your program should display a message…
A: “Since you have asked multiple questions, we will solve the first question for you. If you want any…
Q: An anagram is a word or a phrase formed by rearranging the letters of another phrase such as "ITEM"…
A: As per the given question, we are given two phrases and we have to check if they are anagrams of…
Q: Write an application that displays the numbers 1 to 4 on the same line, with each pair of adjacent…
A: The Answer to the following questions:-
Q: 1. A) Assume that the user input for x is 25. What will be the value of x after the following…
A: A) Initially the value of x is 25. if (x < 100) // Since 25<100 true x = x + 5; // x =…
Q: Write a program that prompts the user to input any digit then swap the position of the first and the…
A: Include the header file. Inside the main function take the input of the element. Take the first…
Q: 1. Create a program that asks for a distance in kilometers and converts it into its metric…
A: /*C program to ask distance in kilometers and converts it into its meter equivalent*/ #include…
Q: Q2: Write a program to compute and display a person's weekly salary as determined by the following…
A: Since no programming language is mentioned, I am using python. Algorithm: Start Read no.of hours n…
Q: 2. Write a program that converts minutes to days, hours and minutes. The program output should be as…
A: Days = inputMinutes / 1440;Hours = inputMinutes / 60;Mins = inputMinutes % 60;
Q: 18. Write a program that allows the user to input two integers, one for the length of the rectangle…
A: Sol 18: The below given C++ program will obey the following rubrics: Including necessary header…
Q: Q2- You have two figures a rectangle and a circle, the circle inside the rectangle. Compute and…
A: Given data is shown below:
Q: Write cout statements with stream manipulators that perform the following: A) Display the number…
A: cout statement: a) cout<<setw(9)<< fixed << setprecision(2)<<34.789;
Q: Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output…
A: import java.util.*;class Test89 { public static void main(String args[]) { Scanner sc = new…
Q: Write a program using flowchart (or python, c++) that computes for the average of scores of a…
A: C++ code: #include <iostream>using namespace std; int main() { int marks[99], m, i, a=0,…
Q: Declare double variables num1, den1, num2, and den2, and read each variable from input in that…
A: Double type variables:- A variable of type double is a 64-bit floating data type.The double data…
Q: code output to the screen
A: int a = 3; if (a % 2) // if(3%2) -->if(1) --> if(true)…
Q: input by the user. (Function) lote: When the user press number 1 - it will print the odd numbers.…
A: void chk(int num[],int ch){ if(ch==1) { Display The odd numbers are: "); for(int…
Q: main() { int a = 1, b = 2, c = 3: printf("%d", a + = (a + = 3, 5, a)) } Output…
A: Solution -: Given code is : main() { int a = 1, b = 2, c = 3: printf("%d", a + = (a + =…
Q: int sizeQfShaps (>= 2 and = 1 and =1 and < = 25) Test 2 For sizeofShape = 7, xCentre = 76, yCentre =…
A: java code for the above output
Q: Question 1: Write a C program that do the following: Ask the user to enter his grade as (A, B, C, D,…
A: Include an appropriate header in the C program such as stdio.h. stdio.h is a C header file that…
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both…
A: //import the required package import java.util.Scanner; //create a main class public class Gallon {…
Q: Write a program which input radius of circle and compute area of it. Then input the length of side…
A: EXPLANATION - Create a program . Declare three variable radius , length , area1 , area2 . Take…
Q: 2. If a five-digit number is input through the keyboard, write a program to print a new number by…
A: Given :
Q: int a 5,b- 3,c; printf("input a "); scanf("%d", &a); printf("input b : ") iscanf("&d", &b); e-a/b;…
A: Answer : 3 As the user input value replace the default values.
Q: [Problem description] Write a program that reads an unspecified number of integer s, and print the…
A: Hello student Greetings Hope you are doing great. Thank You!!!
Q: 1. Federal law requires that hourly employees be paid "time-and-a-half" for work in excess of 40…
A: #ask user for hourly wage hourly_wage = float(input('\nEnter hourly wage: ')) #ask user for Number…
Q: A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number…
A: 1. Input the number of steps and convert it into int and store it in a variable- noSteps 2.…
Q: Q1) input the source code (code1)to the program below(code 2), make sure the program can run with…
A: We have been given the two C language codes. We have to add Code 1 in the Code 2 in such a way that…
Q: Write a program to input a number x from the keyboard. If the number is larger than 0, find its…
A: #include<stdio.h> #include<math.h> int main()…
Q: 2. Write a program that calculates marked area of the square, given input of square length and the…
A: You had not specified any programming language for program but As the heading is assesment is…
Q: An employee’s total weekly pay equals the hourly wage multiplied by the total number of regular…
A: Actually, the code has given below:
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both…
A: #program to find cost for 20,75,500 miles for given miles/galon and gas dollars/gallon#reading…
Q: Write a program that asks the user to enter an integer and then display the hexadecimal…
A: The program that asks the user to enter an integer and then display the hexadecimal representation…
Q: Given the code: int x, y; cout > x >> y; Write a few lines of code that will print all numbers that…
A: I have provided C++ program for the given definition in step 2 with its expected output.
Q: 3)Write a program which prompts the user for their age. If they are 19 or younger inform them that…
A: Note- As per our guidelines we are supposed to answer only one question(first) if there are multiple…
Q: Using switch write a program to insert two float numbers of and an arithmetic effect that refers to…
A: According to the information given:- We have to compile the given code and find the correct option.
Q: Q3: Write a program that reads from the keyboard a distance in meters and the time taken as three…
A: import java.util.Scanner; public class DistanceProgram{ public static void main(String ar[]){…
Step by step
Solved in 2 steps with 1 images
- 10-6. Addition: One common problem when prompting for numerical input occurs when people provide text instead of numbers. When you try to convert the input to an int, you’ll get a ValueError. Write a program that prompts for two numbers. Add them together and print the result. Catch the ValueError if either input value is not a number, and print a friendly error message. Test your program by entering two numbers and then by entering some text instead of a number.10-6. Addition: One common problem when prompting for numerical input occurs when people provide text instead of numbers. When you try to convert the input to an int, you’ll get a ValueError. Write a program that prompts for two numbers. Add them together and print the result. Catch the ValueError if either input value is not a number, and print a friendly error message. Test your program by entering two numbers and then by entering some text instead of a number. 10-7. Addition Calculator: Wrap your code from 10-6 in a while loop so the user can continue entering numbers even if they make a mistake and enter text instead of a number.Write an application that displays the numbers 1 to 4 on the same line, with each pair ofadjacent numbers separated by one space. Use the following techniques:a) Use one System.out.println statement.b) Use four System.out.print statements.c) Use one System.out.printf statement.What does the following code print?d) System.out.printf( "%s\n%s\n%s\n", "*", "***", "*****" );
- 2. Write a program for PIN Code / PUK Code verification for a cell phone. Initialize the PIN Code to 1234 and PUK code to 0123. Prompt the user to enter a PIN Code. If the PIN code entered is correct, display . If failed to enter the correct pin code, display and prompt the user to enter a PUK code. If the PUK code is correct, display . Use java programmingPrint "user_num1 is negative." if user_num1 is less than 0. End with newline. Assign user_num2 with 1 if user_num2 is greater than 12. Otherwise, print "user_num2 is less than or equal to 12.". End with newline. My code: user_num1 = int(input())user_num2 = int(input()) if user_num1 < 0: print("user_num1 is negative.") if user_num2 > 12: user_num2 == 1 else: print("user_num2 is less than or equal to 12.") print('user_num2 is', user_num2) When the input is 0 and 13 my output for user_num2 is 13 and it should be 1. I don't know what I'm doing wrong.flowchart of Many treadmills output the speed of the treadmill in miles per hour (mph) on the console, but most runners think of speed in terms of a pace. A common pace is the number of minutes and seconds per mile instead of mph. You want to solve this problem by developing a program. Your program startswith a quantity in mph and converts the quantity into minutes and seconds per mile. As an example, the proper output for an input of 6.5 mph should be 9 minutes and 13.8 seconds per mile.
- Programming Language: PHP 2. Create a program using switch statements that will ask the user to input an integer. If the first Integer is less than 10, get the product of the two input If the first integer is equal to 10, get the sum of two inputs. Otherwise, divide the integer to 10 and get the remainder as output.TASK 03: Write a program that accepts the input code from user and print according to the input code. If the user enters a number 1, then he would go to heaven. If he inputs 2, then the hell was created within his mind and if he prints any other number then his mother earth is waiting for him. Use nested if-else statements. (Write the program in C++ language)1. The game begins by welcoming the player and asking their name. Input verification is not needed. 2. It then displays the rules of the game and asks for a non-zero positive integer n. Your program must verify the user input. 3. Next, it repeatedly shows options to the player; a set of four quiz questions (described in the next section) and an option to quit the game. 4. The player can select any question of their choice or decide to quit the game at this point. The same question can be selected multiple times. Assignment # 2 Due: Oct 17th, 11:59 PM Page 5 of 11 5. For every question, your program must generate a random DNA strand of length n. The player must answer the selected question for this DNA. 6. The player receives points for every correct answer (see the sample output). Otherwise, they lose 1 point per incorrect answer. Your program must compute the correct answer for a question, verify the player’s answer, and award points accordingly. 7. After every attempt, your program…
- (Display a pattern) Write a program that displays the following pattern:JJ aaa v vaaaJ J aa v v a aJ aaaa v aaaaA mobile phone app allows a user to press a button that starts a timer that counts seconds.When the user presses the button again, the timer stops. Draw a flowchart, write pseudocode and C++ that accepts the elapsed time in seconds and displays the value in minutes and remaining seconds. For example, if the elapsed time was 130 seconds, the output would be 2 minutes and 10 seconds.A movie in a local theater is in great demand. To help a local charity, the theater owner has decided to donate a portion of the gross amount generated from the movie to the charity. This example designs and implements a program that prompts the user to input the movie name, adult ticket price, child ticket price, number of adult tickets sold, number of child tickets sold, and percentage of the gross amount to be donated to the charity. The output of the program is as follows: ** The input to the program consists of the movie name, adult ticket price, child ticket price, number of adult tickets sold, number of child tickets sold and percentage of the gross amount to be donated to the charity. Sample Input: Enter the movie name : Darna Enter the price of an adult ticket: 4.50 Enter the price of a child ticket : 3.00 Enter the number of adult tickets sold : 800 Enter the number of child tickets sold : 1850 Enter the percentage of donation : 10 Sample Output: Movie Name : Darna Number…