Given a long integer representing a 10-digit phone number, output the area code, prefix, and line number using the format (800) 555-1212. Ex: If the input is: 8005551212 the output is: (800) 555-1212 Hint: Use % to get the desired rightmost digits. Ex: The rightmost 2 digits of 572 is done by 572 % 100, which is 72. Hint: Use / to shift right by the desired amount. Ex: Shifting 572 right by 2 digits is done by 572 / 100, which yields 5. (Recall integer division discards the fraction). For simplicity, assume any part starts with a non-zero digit. So 0119998888 is not allowed. Input to program
Q: Write a program that let user to key in two integer numbers and perform calculation by selecting one…
A: Below is the ython program
Q: Accept from the user today’s date and your Date of birth in the format dd-mm-yyyy. Assuming you…
A: The program is to find the total time user had spend in sleeping, eating an reading. Sleeping and…
Q: A number N is represented in HEX as N = (d3 A d1)16, where d1, and d3 are unknown %3D digits base…
A: Answer is given below .
Q: Lab Task #1 You are a detective. You have received the latest intelligence data on the target. The…
A: #include<iostream> using namespace std; unsigned int findNumberOfBits(unsigned int num) {…
Q: Which of the below finds the sum of all numbers from z1 to z2 (both inclusive)?
A: For example, z1 and z2 are initialized to 10 and 20 and the sum of all the numbers will result in…
Q: Write a program that computes the multiples of a positive number in the range 10,5001 • First,…
A: Here is the c++ program of above problem. See below steps.
Q: Given an integer representing a 10-digit phone number, output the area code, prefix, and line number…
A: As no programming language is mentioned, we have solved it using Python language
Q: Write a program that will read five (5) grades in percentile format [0-100] and then determine and…
A: Step 1 : Start Step 2 : Using a for loop take User Input of the 5 Grades and store them in an array.…
Q: Write a program that allows the user to enter the last names of a number of candidates in a local…
A: There is no programming language mentioned, so i have used C++ for program. Please check the step…
Q: What are the values of w, x, y, and z after the following code snippet? Input your answers as…
A: Code:- #include <stdio.h>#include<stdint.h>#include <limits.h>void…
Q: return a pair of integers representing ids of two songs whose combined runtime will finish exactly…
A: Program: public class exampleClass{ public static int checkValue(int songRideDuration, int[]…
Q: Write a program that prompts the user for a positive integer, the first term in a hailstone…
A: C++ used to answer this question
Q: Write a "Wizard Duel Matching" program in Python. In this program, two wizard names will be taken as…
A: import math as m #function to get wizard names from usersdef getWizardNames(): wizard_name =…
Q: Which code segment results in "true" being returned if a number is even? Replace "MISSING CONDITION"…
A: we can say that a number is an even number if that number modulus 2 is equal to zero. Given…
Q: Which one represents the following statement? If k is not an odd positive integer then sum of k with…
A: In question, given that k is not an odd positive integer , this is P(k). And Q(k) is sum of k with…
Q: Determine the distance between point (x1, y1) and point (x2, y2), and assign the result to…
A: The below given Java program will obey the following rubrics: Importing necessary data packages.…
Q: Given the truth values A false, B true, and C true, what is the truth value of each of the following…
A: Truth Value for expression (a): This expression involves two logical symbols disjunction and…
Q: Input N integers (Ask from the user how many nos. he/she wants to input). Determine and print sum of…
A: The answer is given in the below steps.
Q: The formula that will add the value of cell D4 to the value of C2 and then multiply by the value in…
A: Option A is incorrect since there is a syntax error. This is because it is missing a closing…
Q: Input a line of text containing numbers, and determine whether any two consecutive numbers add up to…
A: Please take care of indentation while writing the code.
Q: If f(n) is the number of times that y=y+A[i]; is executed in the code segment below, which of the…
A: The outer loop is for loop controlled by value of j The inner loop is while loop controlled by value…
Q: Which line of code compiles without any errors? while (int n; n < 10) {} while (n < 10) and (n == n…
A: Defined the line of code computers without any errors
Q: Given an integer representing a 10-digit phone number, output the area code, prefix, and line number…
A: PROGRAM CODE: # input the 10-digit number from the usern = int(input("Enter the 10-digits phone…
Q: Given a long integer representing a 10-digit phone number, output the area code, prefix, and line…
A: Java Code is provided below:
Q: python The output of which of the codes shown below will be: “There are 4 blue birds.”? i) ‘There…
A: Answer: %s specifier will print the string %d will print the number.
Q: What is the value of average after the following code? int x, sum = 0,…
A: The syntax of for loop is for(initialization;condition;increment/decrement) Here the variable x is…
Q: In the manual tracing, show the value of variable my_str every time its value changes: #include…
A: // Online C compiler to run C program online#include <stdio.h>#include…
Q: Which code segment results in "true" being returned if a number is even? Replace "MISSING CONDITION"…
A: A number is even if when divided by zero it leaves zero as a reminder. In the condition A. num%2 ==…
Q: Write a program to calculate following series: 1+1/2+1/3+1/4+1/5
A: Computer Programming: Programming is the procedure of forming a set of instructions that directs a…
Q: If ~A = (A & B) is true, then which of the following gives the truth values of A and B? 1 A and B…
A: Given:
Q: 4. Ask the user to input first and second values and based from these range of values, display all…
A:
Q: I'm trying to convert a number from base 10 to another base of choice (between 2 and 10) for z…
A: the answer is given below:-
Q: Given: int num1, num2, newNum;double x, y;Which of the following assignments are valid? If an…
A: Answer – Valid.
Q: if z = 1./(3+x.^2+y.^2), where x and y= -3:0.1:3, could you plot x,y,z as shown below: 03- 0.25- 02…
A: We need to use contour to plot the graph.
Q: nl, n2 and n are integers, and nl < n2. Which of the below finds the sum of all numbers divisible by…
A: We have to find out the sum of all numbers which are divisible by n from n1 to n2(both inclusive)…
Q: Q3\A) Evaluate the following expressions with explanation for each one: int x= 10, y=8, z; 1- z=…
A: As per answering guidelines solving the first question completely. x=10, y=8 1) z=++x - y-- z=…
Q: Which generates a random integer in the range 23..29? O (rand() % (29 - 23)) + 23
A: The function rand() % is used to generate random number. For example rand() %5 will generate random…
Q: Write a program that convert integer Fahrenheit temperature to Celsius or Celsius to Fahrenheit.…
A: Since no programming language is mentioned, therefore, the program is written in C programming…
Q: Q3\A) Evaluate the following expressions with explanation for each one: ( int x= 10, y=8, z; 1- z=…
A: As per our company Guidelines, we are supposed to answer only three sub-parts. For other answer,…
Q: Write a program that calculate the values of (X + Y) x (X – Y) where X, Y = 0, 1, 2, …, 9 and prints…
A: #include<iostream> using namespace std; int main(){ cout << "X|Y 0 1 2 3 4 5 6 7 8 9"…
Q: Q2:What is the range of variable (num) that makes the variable (x) equal to 120: int num,x=100;…
A: x is already assigned to 100
Q: Given two integers, a and b, return true if a can be divided evenly by b. Return false otherwise.…
A: //note : since programming language is not specified, we are providing answer in java public class…
Q: Write a program that generates a random two-digit integer. The program prompts the user to predict…
A: CODE TO COPY:- #include <iostream>#include <string>using namespace std;int main(){…
Q: If f(n) is the number of times that y=y+A[i]; is executed in the code segment below, which of the…
A: Time complexity describes how much time a code takes to execute.
Q: What is the output of the following code: Dim number1, number2, number3, result As Integer number1 =…
A: The output of the code is as follows: number1= 10 number2= 7 number3= 5 result= -13
Q: Ask the user to input first and second values and based from these range of values, display all…
A: I have provided C code below.
Q: Given a long long integer representing a 10-digit phone number, output the area code, prefix, and…
A: Actually, the code for the above is given below:
Q: z1 and z2 are integers and z1 < z2. Which of the below finds the sum of all numbers from z1 to z2…
A: I have given an answer in step 2.
Q: An automobile insurance company provides accident insurance if the vehicle's model year is greater…
A: Program is written in Java language. year and num_of_accidents are the variables to input. Using…
Q: Input a line of text containing numbers, and determine whether any two consecutive numbers add up to…
A: I've executed your code and it is running correctly. Incase there is any indentation problem please…
4
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- Ask the user for an account balance. Show, in descending order, all the accounts that have a balance greater than what the user input. Each entry is int, string, long, double, boolean (name length, name, credit card number, balance, cashback). required output Enter a balance\n9000ENTERAccounts with a balance of at least $9000.00 (sorted by balance)\n Name Account Number Balance Cash Back\n Brand Hallam 3573877643495486 9985.21 No\n Paco Verty 4508271490627227 9890.51 No\n Stanislaw Dhenin 4405942746261912 9869.27 No\nEachelle Balderstone 30526110612015 9866.30 No\n Reube Worsnop 3551244602153760 9409.97 Yes\n Tiphanie Oland 5100172198301454 9315.15 No\n Jordan Rylstone 201715141501700 9135.90 Yes\n7 results\n ---- Enter a balance\n8000ENTERAccounts with a balance of at least $8000.00 (sorted by balance)\n Name…Image shows the question, below is an example output: Latitude: 23 [FAILED] Calculated CRC: 3 Expected CRC: 6 1011100010110000--------00001000 0000100000001011--------00000011 Longitude: 80 [FAILED] Calculated CRC: 5 Expected CRC: 4 10100000001011000000----------0001000000 00010000000001011000----------0000011000 00000110000000010110----------0000001110 00000011100000001011----------0000000101 Elevation: 13548 [OK] 1101001110110000010110000000000000-----------------01100011101100000 0110001110110000001011000000000000-----------------00111011101100000 0011101110110000000101100000000000-----------------00010111101100000 0001011110110000000010110000000000-----------------00000001101100000 0000000110110000000000001011000000-----------------00000000110100000 0000000011010000000000000101100000-----------------00000000011000000 0000000001100000000000000010110000-----------------00000000001110000 0000000000111000000000000001011000-----------------00000000000101000…Given: int num1, num2, newNum;double x, y;Which of the following assignments are valid? If an assignment is not valid,state the reason.a. num1 = 35;b. newNum = num1 – num2;c. num1 = 5; num2 = 2 + num1; num1 = num2 / 3;d. num1 * num2 = newNum;e. x = 12 * num1 - 15.3;f. num1 * 2 = newNum + num2;g. x / y = x * y;h. num2 = num1 % 2.0;i. newNum = static_cast<int> (x) % 5;j. x = x + y - 5;k. newNum = num1 + static_cast<int> (4.6 / 2);
- An automobile insurance company provides accident insurance if the vebicle’s model year is greater ot equal to 2000 and the number of accidens is less or equal to 6, Write & program that prompts the user to cnter his/her vehicle’s model year and the number of accidents. The program then checks whether or not the client s elgible for an insurance and prints the messages as shown in the sample run. Sample Run 1 | Enter your vehicle’s model yea;x: 010 R A ‘( Enter the number of accidents: 3 I You are eligible for an insurance for your vehicle’s model 2010. Sample Run 2: Enter your vehicle's model year: 2005 Enter the number of accidents: 7 You are not eligible for an insurance for your vehicle's model 2005.Write a program that converts U.S. Dollar Amounts to different Cryptocurrencies by multiplying US Dollar amounts times conversion factors stored in named constants. Ask the user to enter the amount of money in U.S. Currency, then display the output of the conversions to the different cryptocurrencies listed below. The following conversion rates must be stored as named constants: 1 US Dollar = 0.00002306 Bitcoin (BTC)1 1 US Dollar = 0.01122814 Ethereum Classic (ETC)1 1 US Dollar = 2.07961078 Dogecoin (DOGE)1 1 US Dollar = 0.48910811 Cardano (ADA)1 Format your currency amounts in fixed point notation with two decimal places of precision, and be sure that the decimal point is always displayed.On a piano, a key has a frequency, say f0. Each higher key (black or white) has a frequency of f0 * rn, where n is the distance (number of keys) from that key, and r is 2(1/12). Given an initial key frequency, output that frequency and the next 4 higher key frequencies. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('%0.2f %0.2f %0.2f %0.2f %0.2f' % (your_value1, your_value2, your_value3, your_value4, your_value5))
- Given an integer representing a 10-digit phone number, output the area code, prefix, and line number using the format (800) 555-1212. Input: 8005551212 Output: (800) 555-1212 My code: phone_number = input() print('(', phone_number[0] + phone_number[1] + phone_number[2] + ') ' + phone_number[3] + phone_number[4] + phone_number[5] + '-' + phone_number[6] + phone_number[7] + phone_number[8] + phone_number[9]) However the output is giving me a space between the first parantheses and the number eight ( 800) 555-1212 How can I remove the space to get the correct formating?Input a line of text containing numbers, and determine whether any two consecutive numbers add up to 10. Print True if two such numbers exist, and False otherwise. If there are fewer than two numbers in the input string, print False. Examples: If input string is "2 5 4 6 3", output is True since 4 + 6 is 10 If input string is "2 5 4 3 6", output is False If input string is "3 42 2 9 27 137 -127 66 99", output is True since 137 + -127 is 10If x = 2222 , what is the value of each of the following expressions ? x % 10 x / 10 (x / 10) % 10 x / 100 (x / 100) % 10
- Write a program that calculate the values of (X + Y) x (X – Y) where X, Y = 0, 1, 2, …, 9and prints the following table:X|Y 0 1 2 3 4 5 6 7 8 90| 0 -1 -4 -9 -16 -25 -36 -49 -64 -811| 1 0 -3 -8 -15 -24 -35 -48 -63 -802| 4 3 0 -5 -12 -21 -32 -45 -60 -773| 9 8 5 0 -7 -16 -27 -40 -55 -724| 16 15 12 7 0 -9 -20 -33 -48 -655| 25 24 21 16 9 0 -11 -24 -39 -566| 36 35 32 27 20 11 0 -13 -28 -457| 49 48 45 40 33 24 13 0 -15 -328| 64 63 60 55 48 39 28 15 0 -179| 81 80 77 72 65 56 45 32 17 0Write a program that asks the user to enter 2 integers of 4 digits and displays thedifferent digits as X and * if they are the same. If the user enters a number which is notof four digits, then a convenient message is displayed.Write a program that asks the user to enter 10 numbers, that range from 0-100. Make sure that you do not accept any numbers less than 0, if a user enters a number that is less than 0 then ask him again. Once the user enters all 10 numbers, find and print out the median. How to calculate the Median The median is the middle score of a distribution. To calculate the median Arrange your numbers in numerical order. Count how many numbers you have. If you have an odd number, divide by 2 and round up to get the position of the median number. If you have an even number, divide by 2. Go to the number in that position and average it with the number in the next higher position to get the median. Consider this set of numbers: 5, 7, 9, 9, 11. Since you have an odd number of scores, the median would be 9. You have five numbers, so you divide 5 by 2 to get 2.5, and round up to 3 (to round numbers in C#, use Math.Round()). The number in the third position is the median. In this case, the mean…