Using Java loops
Write a program that finds all the perfect squares and
cubes of numbers from 1 to a number entered by the
user.
If the number it is examining is a perfect square, it
prints the number user followed by “ is a perfect
square”
If the number it is examining is a perfect cube, it
prints the number user followed by “ is a perfect
cube”
import java.util.Scanner; public class PerfectSquaresCubes { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter a max value: "); int n = in.nextInt(); for (int i = 2; i <= n; i++) { for (int j = 2; j <= n; j++) { if (j*j == i) { System.out.println(i + " is a perfect square"); } if (j*j*j == i) { System.out.println(i + " is a perfect cube"); } } } } }
Using Java loops Write a program that finds all the perfect squares and cubes of numbers...
Write a Visual Basics program that calculates the squares and cubes of the numbers 0 through 5 and displays the resulting values in table format as follow: Number Square Cube 0 0 0 1 1 1 2 4 8 3 9 27 4 16 64 5 25 125
**** Using java write a program that finds the standard deviation of a set of numbers. it also has to prompt the user to enter a set of numbers.
Question 4-6 Please. Python 3.6. def main(). entered by a user. Write a program that finds the sum and average of a series of numbers he program should first prompt the user to enter total numbers of numbers are to be summed and averaged. It should then as for input for each of the numbers, add them, and print the total of the numbers and their average 2. Write a progra m that finds the area of a circle. The...
In java, write a program that gets 10 integer numbers from the user using user input, and then calculates and display the sum of the numbers that have been read. Program Requirements: Write the program in three versions with three loops. Put all three loops in the main method of your source code. version1: use a while loop. version2: use a do-while loop. version 3: use a for loop. For each version, use a loop to input 10 int numbers from the user...
Please write a java program that takes in user input of various numbers as a type string, prints the sum of all numbers entered, and prints the smallest and largest numbers. Arrays are optional as they have not been covered by my professor yet. Thank you
Java Write a program that will look for two perfect squares, both odd, that will add together to make another perfect square. Ex--->3^2+4^2=5^2 , 5^2+12^2=13^2 , 6^2+8^2=10^2 , 7^2+242^=25^2
In C++ using For Loops; "Write a program that displays number facts for a number provided by the end user between 1-100 in a table format that includes the number itself, whether the number is a prime number, whether the number is even or odd, whether the number is a perfect square and all of its factors. " It should also print this information.
Lab 5-2 Nested Loops 2. Summation Of Numbers (using Nested While Loops) Part A: The program will calculate and display the total of all numbers up to a specific number (entered by the user). Only positive numbers are allowed. Part B: User-controlled loop Part A Input Validation loop Part A: Summation loop Examples: When 5 is entered the program will calculate the total as 1+2+...+5 and display 15. When 2 is enterered the program will calculate the total as 1+2...
Write a Java program which allows the user to perform simple tasks on a calculator. A series of methods allows the user to select an operation to perform and then enter operands. The first method displays a menu, giving the user the choice of typing in any one of the following: +, -, *, /, or % representing the usual arithmetic operators (Each operation should be done on numbers negative(-) to positive(+), positive(+) to negative(-), negative(-) to negative(-), and positive(+)...
Using loops, write a C# program that asks the user to enter repeatedly an integer number, it stops when the user enters -1, then the program should display how many numbers were entered, their the sum and their average