Write a program that reads an integer between 1972 and 2001 (year of birth). Print the age group that the person belongs to: twenties, thirties, forties. If the integer is 1971 or less, print "You're too old." For 2002 and above, "You're too young." Sample Run 1: Enter the year of birth : 1998 You're in your twenties. Sample Run 2: Enter the year of birth : 1950 You're too old. Sample Run 3: Enter the year of birth : 1972 You're in your fourties. Sample Run 4: Enter the year of birth : 2017 You're too young.
Q: Write a program that takes the user age and prints the following: Print too old, if age is greater…
A: Use if else if statements to check all the conditions one by one
Q: Write a program that prints all numbers between 1 and 100 that are divisible by both 5 and 7.
A: for num in range(1,100): if num%5==0 and num%7==0: print(num)
Q: Write a java program that allows the user to enter his name and his year of birth, the program…
A: Start Take the input of the age. Compute the age. Print the age with years, month, days Print the…
Q: Write a program that reads a floating point number and prints "zero" if the number is zero.…
A: """Program will read a floating-point number and print "zero"if the number is zero.Otherwise, print…
Q: Write a program that calculates and prints the bill for a cellular telephone company, on the type of…
A: Actually, program is a executable software that runs on a computer.
Q: Write a program that will compute for the salesman's commission based from his total sales for the…
A: As no programming language is mentioned, it is solved using basic C++
Q: Write a program that asks users when their birthday is. Use information provided to give them their…
A: Program Approach - Use the header files as per the requirement for the code. Define the main…
Q: Write a program that reads a person's first and last names separated by a space, assuming the first…
A: First, we will input first and last name. Then we will replace space with ", ". And finally, print…
Q: Write a program with total change amount in pennies as an integer input, and output the change using…
A: Java Code: import java.util.Scanner; public class LabProgram { public static void…
Q: Write a program that reads the price and the production date(month and year of an item) then prints…
A: import java.util.*;import java.io.*; public class Main{ public static void main(String[] args)throws…
Q: Write a program that will check and print if the person is a regular passenger, student or senior…
A: Program Code: #include<stdio.h>#include<conio.h>main(){ int ch,fare; printf("If you are…
Q: Write a program that prompts the user to input an integer and then outputs both the individual…
A: Program plan: Include the necessary header files. in the main method declare the character array.…
Q: Write a program that reads a bank aCcount balance and an interest rate and displays the value of the…
A:
Q: Write a program that reads the name, the gender (F/M) and age of the user and checks if he can go…
A: Create 3 variables (String)name, (int) age and (char) gender. Take input name from user and store in…
Q: Write a program that reads from the user the initial KiloMeters of the car, the current KiloMeters,…
A: Answer
Q: Write a program that prompts the user to enter the minutes (e.g., 1 billion), and displays the…
A: NOTE: SINCE THE LANGUAGE OF THE CODE IS NOT MENTIONED, I HAVE USED JAVA FOR THE SOLUTION. Define…
Q: ncreme
A: The program provided below calculates flame theoretical temperature when a mixture of methane,…
Q: Write a program that can be used to calculate the federal tax. The tax is calculated as follows: For…
A: Purpose of the program: This program computes the taxable income and the federal tax amount for a…
Q: Write a program that can be used to calculate the federal tax. The tax is calculated as follows: For…
A: The question is to write a code for the given problem and no language has been mentioned, here C++…
Q: Write a program using if, and elif and else, that asks the user what their favorite food is. Then…
A: According to the information given:- We have to create the program in that we as user to tell his…
Q: Write a program to take orders for a computer shop and print a bill. Your program asks for the…
A: **THIS CODE IS WRITTEN IN PYTHON SINCE NO PROGRAMMING LANGUAGE WAS MENTIONED. #input values item…
Q: Java, a real estate office handles 50 apartment units. When rent is $600 per month, all the units…
A: Actually, java is a object oriented programming language.
Q: Write a program that read an integer, and then finds and prints the sum of the even and odd…
A: As per the requirement program is developed. Note : As per our guidelines we are suppose to answer…
Q: Write a program that computes the amount of calories burned when you run. Your program should ask…
A: Hi there, Please find your solution below, I hope you would find my solution useful and helpful.…
Q: Write a program that calculates an adult's fat-burning heart rate, which is 70% of 220 minus the…
A: Start input age through get_age function if person is not in between 18 to 75 the print message…
Q: Write a program that splits a 4-digits integer number into thousands, hundreds, tens, and ones. For…
A: Note: Answering the question in python as no language is specified. Input : Input the number.…
Q: Write a program with total change amount as an integer input, and output the change using the fewest…
A: Code: #include <stdio.h>int main(){ int cents,dollars,quarters,dimes,nickels,pennies;…
Q: Write a program that simulates a snail trying to crawl up a building of height 6 steps. The snail…
A: Actually, given information. Write a program that simulates a snail trying to crawl up a building of…
Q: Write a program that reads an integer between 0 and 1000 and multiplies all the digits in the…
A: SINCE NO PROGRAMMING LANGUAGE WAS MENTIONED, THIS CODE IS WRITTEN IN PYTHON.
Q: Write a program that calculates the potential energy of 3 charges q1 = 1, q2 = 2, q3 = 3 located at…
A: Distance between two points P1(x1,y1,z1) and P2(x2,y2,z2) = x2-x12+y2-y12+z2-z12 Put all the values…
Q: Write a program that will figure out the required change for a purchase. Start by asking the user…
A: Introduction of the Program: The Java Program takes the cost of the product and amount paid from the…
Q: Write a program for determining if a year is a leap year. In the Gregorian calendar system you can…
A: Answer :
Q: Write a program to determine the number of thousands, hundreds, tens, and ones in a given integer…
A: Code: #include <iostream>using namespace std; int main(){ int thousands, hundreds, tens,…
Q: Write a program that asks the user how many credit units they have taken. If they have taken 23 or…
A: Program Approach: Include the necessary header files for the standard I/O. Declare a user input…
Q: Write a program that reads some integers between 1 and 100 and counts the occurrences of each.
A: Lets see the solution.
Q: Write a program that will count the number of votes for each candidate, show the total number of…
A: Use an array to store the votes for each candidate and keep on voting till user wish to quit
Q: Write a program that can be used to calculate the federal tax. The tax is calculated as follows: For…
A: PROGRAM: //header files #include <iostream> #include<iomanip> //using namespace using…
Q: Write a program for determining if a year is a leap year. In the Gregorian calendar system you can…
A: Since programming language is not mentioned, I have done this using Python 3.
Q: Write a program that asks the user for a negative number, then prints out the product of all the…
A: Solution: Since any specific language for the above question is not mentioned, we have solved…
Q: Write a program that can be used to calculate the federal tax. The tax is calculated as follows: For…
A: Python Code Standard_Exemption = 4000; Tax_Salary = 0.0 tax = 0.0 child = 0 Marital_Status =…
Q: Write a program that reads from the user the initial KiloMeters of the car, the current KiloMeters,…
A: Step-1: Start Step-2: Declare variable currentKm, initialKM, fuelAmount and fuelConsumption Step-3:…
Q: . Write a program that computes the theoretical flame temperature when a mixture of methane,…
A: This program provided below calculates flame theoretical temperature when a mixture of methane,…
Q: Write a program that can be used to calculate the federal tax. The tax is calculated as follows: For…
A: Actually, c++ is a powerful general purpose language. The, code has been below:
Q: Write a program that calculates the cost per square inch of a circular pizza,given its diameter and…
A: We need to find the per square inch of any circular pizza where diameter and price of pizza will be…
Q: Write a program that read a positive number and determine whether it is odd or even number. Print…
A: In the solution i have Made an Python program for a positive number to input by the user and…
Q: Write a program that helps the user count his change. The program should ask how many quarters the…
A: Java program is asked for the given requirements.
Q: Write a program that can be used to calculate the federal tax. The tax is calculated as follows: For…
A: Purpose of the program: This program computes the taxable income and the federal tax amount for a…
Q: Write a program that outputs all the integers between 100 and 1000 (inclusive), that are divisible…
A: Approach: create a class inside main method iterate the for loop to check for condition for number…
Step by step
Solved in 2 steps with 1 images
- /*code Kth Largest Factor A positive integer d is said to be a factor of another positive integer N if when N is divided by d, the remainder obtained is zero. For example, for number 12, there are 6 factors 1, 2, 3, 4, 6, 12. Every positive integer k has at least two factors, 1 and the number k itself.Given two positive integers N and k, write a program to print the kth largest factor of N. Input Format: The input is a comma-separated list of positive integer pairs (N, k). Output Format: The kth highest factor of N. If N does not have k factors, the output should be 1. Constraints: 1<N<10000000000 1<k<600. You can assume that N will have no prime factors which are larger than 13..Q3: Interplanetary Spaceflight Milan Tusk is the richest person in the universe. After devoting decades of his life to further our space exploration technologies, he’s finally ready to retire. Being a space enthusiast, the first thing he wants to do is visit n planets p1, p2, …, pn, in this order. He’s currently on planet p0. Milan knows that the distance between planets pi and pi + 1 (for 0 ≤ i < n) is d[i]light years. His spaceship uses 1 tonne of fossil fuels per light year. He starts with a full tank and can fill up his tank at any of the n planets (but he must not run out in between two planets). There’s a huge cost to set up the spaceship for refuelling. Due to financial constraints (he’s not THAT rich), he can fill up his tank at most ktimes. In order to save money and make his spaceship lighter, Milan is looking for the smallest possible fuel tank that enables him to complete his space travel and reach planet pn. What is the smallest tank capacity that enables him to do so?…i want code in python Rahul is a maths genius so he came up with a game and as raj is Rahul's best friend so Rahul decided to play the game with raj. Rahul gives raj two numbers LL and RR and asks raj to find the count of numbers in the range from LL to RR (LL and RR inclusive) which are a digit palindromic. A number is a digit palindromic if its first digit is the same as its last digit. As raj is not very good at maths so your task is to help Raj find out how many numbers are a digit palindromic in the range LL to RR. For example if LL = 88 and RR = 2525 .The following numbers are a digit palindromic in the range of LL to RR: 8, 9, 11, and 22. If LL = 12511251 and RR = 12661266. The digit palindromic numbers are 1251 and 1261. Input format The first line contains an integer denoting the number of test cases. Each test case is described by a single line that contains two integers LL and RR. Output format For each test case output, an integer denoting how many a digit palindromic…
- le.com/forms/d/e/1FAlpQLSc6PlhZGOLJ4LOHo5cCGEf9HDChfQ-tT1bES-BKgkKu44eEnw/formResponse The following iterative sequence is defined for the set of positive integers: Sn/2 3n +1 ifn is odd if n is even Un = Using the rule above and starting with 13, we generate the following sequence: 13 u13 = 40 u40 =20 u20 = 10→ u10 =5 u5 = 16 u16 = 8 ug = 4 → Us =2 u2 =1. It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. The below function takes as input an integer n and returns the number of terms generated by the sequence starting at n. function i-Seq (n) u=n; i=%3; while u =1 if statement 1 u=u/2; else statement 2 end i=i+1; end statement 1 and statement 2 should be replaced by: None of the choices statement 1 is "mod(u,2)=D%3D0" and statement 2 is "u = 3*u+1;" statement 1 is "u%2" and statement 2 is "u = 3*u+1;" O statement 1 is "mod(n,2)=30" and statement 2 is "u = 3*n+1;"F = Math.max(-2, -4) * Math.abs(-4). What is the value of F ? a.-16 b.8 c.16 d. -8Code language Java 1, Add a print statement to say “Multiplication Table” and then prompt theuser to enter an integer. Your program should then prints “times table” for thenumbers from 1 to the given integer (inclusive). That is, for input n, you would printa table of n rows (lines) each with n columns, where the cell at row i and columnj contains the value i × j. You do need separate rows, but don’t worry about thecolumns lining up nicely yet. 2. Add a print statement to say “Prime Testing”.Using the integer entered by the user above, print out all the prime numbers between2 and the number squared. E.g., if the user types 12 for the multiplication table part,you should print all the prime numbers that are not larger than 144.All integers are either prime or composite. A prime number is one that has no integerfactors other than itself or one. Examples are 2, 3, 5, 7, 11, 13, . . .. A compositenumber, by contrast, has multiple factors. Examples are 4, 6, 12, 15, 18, 21, . . ..Testing…
- (Numerical) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters to 0, and then generate a large number of pseudorandom integers between 0 and 9. Each time a 0 occurs, increment the variable you have designated as the zero counter; when a 1 occurs, increment the counter variable that’s keeping count of the 1s that occur; and so on. Finally, display the number of 0s, 1s, 2s, and so on that occurred and the percentage of the time they occurred.Write your codes in a single m.file Write commend to each line for explaining the line Write a code to generate the x and y values for a single butterfly using a for loop. The equations for a butterfly were discovered by Temple H. Feyl in 1989: f = ecost - 2 cos(4t) -(sin ) x = xo +s* f * sint y = yo +s f* cost Here t goes from 0 to 40pi (first try with step size of 1 and then change it to step size of 0.01), x0 and y0 are the location of the butterfly center, and s scales the height of the butterfly. Notice that these are algebraic equations, not differential equations. Also pay attention for element by element calculations in matrix operations. 1) Plot a magenta butterfly by considering s=0.1, x0=1, y0=1 2) Plot a different figure blue butterfly having twice height of the first one, x0=3, y0=3 3) Put both plots in a single figure Write Happy Spring as tittle, Happy to y-axis and Spring to the x-axis and legend Loving Butterflies! of all figures.Task 9 Write Python code of a program that reads an integer, and prints the integer if it is a multiple of NEITHER 2 NOR 5. For example, 1, 3, 7, 9, 11, 13, 17, 19, 21, 23, 27, 29, 31, 33, 37, 39 ... hint(1): use the modulus (%) operator for checking the divisibility hint(2): You can consider the number to be an integer !%3%===== Example01: Input: 3 Output: 3
- Let A = {a, b, c} and B = {u, v}. Write a. A × B b. B × AWrite your codes in a single m.file Write commend to each line for explaining the line Write a code to generate the x and y values for a single butterfly using a for loop. The equations for a butterfly were discovered by Temple H. Feyl in 1989: = cos* - 2 cos(4t) –(sin() x = xo +s* f * sint y = yo +s* f * cost Here t goes from 0 to 40pi (first try with step size of 1 and then change it to step size of 0.01), x0 and y0 are the location of the butterfly center, and s scales the height of the butterfly. Notice that these are algebraic equations, not differential equations. Also pay attention for element by element calculations in matrix operations. 1) Plot a magenta butterfly by considering s=0.1, x0=1, y0=1 2) Plot a different figure blue butterfly having twice height of the first one, x0=3, y0=3 3) Put both plots in a single figure Write Happy Spring as tittle, Happy to y-axis and Spring to the x-axis and legend Loving Butterflies! of all figures. Here is a hint for the item 1 output;…PYTHON QUESTION : The Syracuse sequence of an integer N is the sequence of integers starting with the term N, where each following term is half of the preceding term if it is even, and one plus three times the preceding term if it is odd. The sequence ends when it reaches the integer 1. The maximum of the Syracuse sequence of an integer N is the highest number reached by this sequence. This maximum can sometimes be very high compared to the starting integer N. What is the maximum of the Syracuse sequence of 3428767? To answer this question it is useful to modify the code given in demonstration which calculates the Syracuse sequence. The code given in the demo : n = 27 print(n) while n != 1: if n%2 == 0: n = n // 2 # where n //= 2 or n >>= 1 else: n = 1 + 3*n print(n)