Question: Answer the following: A-In the main function provided, write a program that asks the user to input two integers and prints out the rst integer
Answer the following:
A-In the main function provided, write a program that asks the user to input two integers and prints out the rst integer raised to the second (e.g. if the user enters 2 and 4, the program prints 16, which is 2^4). You do not have to write any imports or public class : : : . Please just fill in main. public static void main(String args[]) {
b-Write the few lines of code that print all of the integers between 5 and 1000 that are evenly divisible by 6.
c-Write a java program which asks the user to enter three integers. The program prints "between" if the 2nd number falls in between the 1st and 3rd, and "not between" if it doesn't. For example, if I enter 1 10 27, the program prints "between", and if I enter 5 9 6, the program prints "not between".
d-Write a static method named twoConsecutive that accepts three integers as parameters and returns true if there is at least one pair of integers that di er by exactly 1. For example, the integers 3 and 4 di er by 1. The integers 12 and 11 also di er by 1. Your method should return false if there are no such consecutive values. The integers could be passed in any order; the two consecutive values could be any of the two values passed in. Here are some sample calls: Call Output twoConsecutive(1, 2, 12) true twoConsecutive(1, 12, 2) true twoConsecutive(2, 12, 1) true twoConsecutive(4, 5, 3) true twoConsecutive(2, 4, 6) false twoConsecutive(8, 8, 8) false
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
