Question # 8: Write a program that inputs a number and checks whether it is a perfect number or not. A perfect number is the number that is numerically equal to the sum of its divisors. For example, 6 is a perfect number because the divisors of 6 are 1, 2, 3 and 1+2+3=6
Q: A triangle is considered valid if the sum of each 2 sides is greater than the remaining third side.…
A: We have to write a program a program that takes the length of three sides and print "equilateral",…
Q: 3. Scientific notation is a way to express numbers that are too large in a more convenient decimal…
A:
Q: Mother is the most loved person. She wants to surprise his son on his birthday so she prepares a…
A: Process: Input for the value which decide the total iteration After that run the value loop…
Q: 2) A BMI Calculator: the body mass index (BMI) is a measure used to determine whether a person is…
A: Java Code import java.util.Scanner; public class Test { public static void main(String[] args) {…
Q: Write a program that takes a range from the user and display all the even numbers between the range…
A: Note - Since there is nothing mentioned about the programming language to be used, so this program…
Q: Write a program that makes use of random number generator from Math.random(). When finished, the…
A: Java language contains the API class called Math. The class Math contains several mathematical…
Q: A positive whole number n > 2 is prime if no number between 2 and n (inclusive) evenly divides n…
A: Python program: from math import sqrt def prime(n): divisor = 2 found = False…
Q: Q1: Write a program that reads 10 numbers and then finds the largest number and prints it and finds…
A: - The question wants us to find the largest and smallest number after reading 10 numbers and print…
Q: "QUICK-BASIC64 Write an algorithm that finds and prints the sum of the first N terms of the series…
A: CLS A = 1 INPUT "ENTER NUMBER OF TIMES THE SERIES WILL RUN="; N FOR I = 1 TO N PRINT A; A = A +3…
Q: Python Calender library- Write a program that takes input year number from user and print the…
A: Here have to determine about python code for print whole year calander.
Q: Write a program that calculates the electricity bill. The rates of electricity per unit are as…
A: A function is a square of code which possibly runs when it is called. You can pass information,…
Q: Question: Write A Program That Compares The Values Of Y1 And Y2 In.. 3. ( Write a program that…
A: Given:
Q: Q1: Write a program that determines whether the input year is Leap or Simple, Where the leap year is…
A: //Program of leap year #include <stdio.h>int main() { int y; printf("Enter a year: ");…
Q: Practical quiz 2 Write a Java program that will ask the user for the number of rooms (including…
A: import java.text.DecimalFormat;import java.util.Scanner; public class RoomChargeMain { public…
Q: 1. Write a an algorithm that asks the user to input a positive integer n and counts how many of the…
A: The algorithm is a step-by-step program instruction in a human-readable format. The number of steps…
Q: Display basic salary, bonus and net salary
A: EXPLANATION--> Firstly input two variable named with salary and grade If grade is greater then…
Q: A perfect number is a positive integer that is equal to the sum of its positive divi- sors except…
A: code:- function output = perfectNumbers(n)output = zeros(1,n);for i = 1:ntest = 1:i-1;if…
Q: Write a program that makes use of random number generator from Math.random(). When finished, the…
A: Required: Write a program that makes use of random number generator from Math.random(). Required…
Q: 2. Write a program that will read a number and will display the factors of the number. Factors are…
A: As per our guidelines we are supposed to answer only one question. Kindly repost the remaining…
Q: Write a program in which user is asked to enter two integers (divisor and dividend) and computes the…
A: Program Explanation :- In this Program, the user is required to enter two numbers (separator and…
Q: 1. Write a program that prints your name, age, and department in console 2. Write a program that…
A: As no programming language is mentioned, it is solved using C++
Q: Write pseudo code that will calculate a running sum. A user will enter numbers that will be added to…
A:
Q: Exercise 30 defines the number e and Exercise 31 shows how to approximate the value of e using a…
A: Since no programming language is mentioned. I am attempting this in python. if you need it in any…
Q: beginers given real numbers a,b,c, a≠0 Solve the equation 2x+bx+c=o
A: Given: Solve the equation ax^2+bx+c=o The solution for ax^2+bx+c will be x=(-b±b2-4ac )(2*a) So we…
Q: Exercise 1: In this exercise we are asked to write a program that prompts the user for a positive…
A: Input n if(n>0) { while(n>0) { r=n%10; //find remainder…
Q: A perfect number is a positive integer that is equal to the sum of its positive divi- sors except…
A: Answer: % Create perfectNum() function function myNum-perfectNum(num) %num=10000 if you want four…
Q: Can someone help me answer this in Coral programming language? 1) The year must be divisible by 4…
A: Answer :
Q: /* This program should play a game with the user asking her to guess a target number (randomly…
A: As no programming language is mentioned, it is solved using Java
Q: Set the value of the variable a to be 191 Set the value of the variable b to be 3 If a is divisible…
A: 1. Set the value of the variable a to be 191 2. Set the value of the variable b to be 3 3. If a is…
Q: TotalPayAA.java Write a program that will calculate an employee’s total pay for a week (hourly pay…
A: Program Approach: Import necessary packages for scanning Input create a class TotalPay and Define…
Q: Problem 7: Guess the price of the car!? You will implement a variant of the number guessing game we…
A: Python used to answer this question
Q: if characters ‘Y’, ‘R’ and ‘B’ represents the primary colors Yellow, Red and Blue; this algorithm…
A: if characters ‘Y’, ‘R’ and ‘B’ represents the primary colors Yellow, Red and Blue; this algorithm…
Q: Q5/ 1. 1. Write a program to read three marks and calculate the average. If the student's average is…
A: Since no programming language is mentioned, I am using python. As per our guidelines, we are…
Q: (b) A triangle can be classified based on the lengths of its sides as equilateral. isosceles or…
A: Algorithm for the code: Step 1: Declare three sides of the triangle. Step 2: Enter three sides at…
Q: there are three seating categories at a stadium. for a softball game, class A seats are $30, Class B…
A: Since no programming language is mentioned, I am using python. Code: print("Enter number of tickets…
Q: When you borrow money to buy a house, a car, or for some other purposes, then you typically repay it…
A: Actually, program is a executable software that runs on a computer.
Q: A regular polygon has n number of sides with each side of length s. The area of a regular polygon is…
A: Introduction : Here we have to write a program and the output of the program should be the area and…
Q: 1. A 10% discount is applied to purchases over $10.00. Write a program that asks for amount…
A: The program is created as follows: Declare variables for purchase amount, discount and discounted…
Q: C++ coding In order to paint a wall that has a number of windows, we want to know its area. Each…
A:
Q: 4) Roll the dice 2 Make a program that tests the probability of a certain score when rolling x dice.…
A: Programming language is Visual Basic.NET Steps to create a visual basic.net project to perform the…
Q: 3. The program that asks a number and test the number whether it is multiple of 5 or not, divisible…
A: #3. number = int(input("Enter a number: ")) # taking the number from user if…
Q: A perfect number is a positive integer that is equal to the sum of its positive divi- sors except…
A: Answer :
Q: A perfect number is a positive integer that is equal to the sum of its positive divi- sors except…
A: Required:
Q: Write a program in python that asks the user to enter a word and then capitalizes every other letter…
A: PROGRAM CODE: st = input("Enter the string: ") // take original string from…
Q: • Write a program that computes the average of 5 students grades which are entered by the user.…
A: Please find the answer below :
Q: 1- Write a program in which the user is asked to enter his age based on the year (assuming the…
A: Take input from user. check if the number is positive integer or no. and if the number is positive…
Q: In an eye-glass shop, a customer can buy either a pair Ol Sngle prescription sunglasses. On each…
A: Since no programming language was mentioned in the question, I have solved in C language.
Q: Write a program that prompts the user to enter a nonnegative integer and outputs the factorial of…
A: Approach To calculate factorial of any non-negative number, we can use either loop (for or while) or…
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
- 1. Write a program that lets the user guess whether a randomly generated integer would be even or odd. The program randomly generates an integer and divides it by 2. The integer is even if the remainder is 0, otherwise odd. The program prompts the user to enter a guess and reports whether the guess is correct or incorrect.4) Roll the dice 2 Make a program that tests the probability of a certain score when rolling x dice. The user should be able to choose to roll eg 4 dice and test the probability of a selected score eg 11. The program should then do a number of simulations and answer how big the probability is for the selected score with as many dice selected. There must be error checks so that you cannot enter incorrect sums, for example, it is not possible to get the sum 3 if you roll 4 dice. TarningsKast2 How many dices do you want to throw? 11 Which number do you want the probability for? The probability the get the number 11 with 4 dices is 7.19% Calculate9: perfect.cpp) A number is called perfect if the sum of its divisors is equal to the original number. A number is called deficient if the sum of its divisors is less than the original number. A number is called abundant if the sum of its divisors is more than the original number. Write a program that answers the following questions: What numbers below 5000 are perfect? What odd numbers below 5000 are abundant? What are the relative proportions of deficient, abundant, and perfect numbers? 5000 should be in a global constant.
- Guess The Number Game: write a program that will ask the user to guess a secret numberrandomly generated by your program between 1-10. Player have 3 trials to guess the number.After each trial, you have to inform the user, either he/she has guessed it correctly or not, andthe remaining trials to guess the number. In each trial your program should generate a newrandom number. If user guess at least twice correctly, then shows the message, “you won by 2-1” and vice versa for losing.When game is over, ask the user to play again: If the user types "yes", the game start again.else stop the game.Arranging Pebbles Write a program that can arrange a group of pebbles into its designated position. We have 4 types of pebbles: Red, white, blue, and green colored pebbles. Supposed that we have an n-number of pebbles, the program should be able to check the color of the pebble and arrange them in such a way that it will look something like this: Example, if there are 9 pebbles; 1 green, 3 white, 2 blue, and 3 red, the program will output something like this: RRRWWWBBGArranging Pebbles Write a program that can arrange a group of pebbles into its designated position. We have 4 types of pebbles: Red, white, blue, and green colored pebbles. Supposed that we have an n-number of pebbles, the program should be able to check the color of the pebble and arrange them in such a way that it will look something like this: Example, if there are 9 pebbles; 1 green, 3 white, 2 blue, and 3 red, the program will output something like this: RRRWWWBBG NOTE: The program will let the user to enter the pebbles and then the program will automatically arrange it. Sample output 1: R=Red, W-White, B=Blue, G=Green Enter pebbles: rwgbrgwbrg Arranged pebbles: RRRWWBBGGG Sample output 2: R=Red, W-White, B=Blue, G=Green Enter pebbles: abcde Invalid input Notice that the arrangement of the pebbles is: Red, White, Blue, Green
- Q1: Write a program that reads 10 numbers and then finds the largest number and prints it and finds the smallest number and prints it.Extreme Fizz BuzzFizz Buzz is a classic Computer Science problem about Selection. For an integer x, print:• “Fizz” if x is only divisible by 3,• “Buzz” if x is only divisible by 5,• “FizzBuzz” if x is divisible by both 3 and 5,• the number x if it is not divisible by both 3 and 5.This problem is the extreme version of Fizz Buzz. You are given a list of K distinct integers A and a list of K characters S. Both lists are numbered from 1 to K. The integer Ai corresponds to the character Si. Denote B as the subset of A. There will be a rule for each possible subset: if an integerx is only divisible by all elements in B, print a string which is the concatenation of the corresponding character of each element in B, sorted by the index in ascending order. However, if B is an empty subset, print the first digit of x instead. Does it look complicated? Do not worry, as it is just a generalization of the regular Fizz Buzz. For example, if A = [3, 5] and S = [F, B], you will get the normal Fizz…Area and Perimeter: Write a program that prints the area and perimeter of a circle with a radius of 5.5 using the formula: Perimeter = 2 * radius * PI Area radius * radius * PI Use Math.PI for PI in your program.
- Problem Description: In the Whimsical Library, each book is enchanted with a magical code to ensure the protection of knowledge. The validation process for these magical codes involves a combination of mathematical spells. The validation process is described as follows: Take the sum of the digits at odd positions from left to right. Take the sum of the squared digits at even positions from left to right. If the absolute difference between the results from step 1 and step 2 is a prime number, the book code is considered valid; otherwise, it is invalid. Example 1: Consider the magical book code 86420137. Step 1. Take the sum of the digits at odd positions from left to right. 8+4+0+3=15 Step 2. Take the sum of the squared digits at even positions from left to right. 6^2+2^2+1^2+7^2=36+4+1+49 = 90 Step 3. If the absolute difference between the results from step 1 and step 2 is a prime number. 115-901 75 (not a prime number) Book code 86420137 is invalid. Example 2: Now, let's examine the…Happy Numbers Programming challenge description: A happy number is defined by the following process. Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers, while those that do not end in 1 are unhappy numbers. Input: Your program should read lines of text from standard input. Each line contains a single positive integer, N. Output: If the number is a happy number, print 1 to standard output. Otherwise, print 0. 1 process.stdin.resume(); 2 process.stdin.setEncoding('utf8'); 3 4 let stdin = ''; 5 process.stdin.on('data', (chunk) => { stdin = '$(stdin)${chunk}"; 7)).on('end', () => { 6 9 8 const lines = stdin.trim().split('\n'); for (const line of lines) { process.stdout.write('$(line)\n'); 10 11 } 12 }); 13 H > Test Case Output & G eFibonacci sequence: The first two numbers of the fibonacci sequence are 1 and 1, and sequential numbers are the sum of the previous two. Write a program that prompts the user for an integer n and then prints the first n numbers of the Fibonacci sequence (Please type answer no write by hend)