Here is the final code for a program that RETURNS the number (from another method to the main method):
import java.util.*;
public class Example
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Please enter two numbers to generate a number between (inclusive) those two numbers");
System.out.println("Please enter the first:");
int d = in.nextInt();
System.out.println("Please enter the second:");
int e = in.nextInt();
int g = randomBetween(d, e);
}
public static int randomBetween(int d, int e)
{
Random random = new Random();
int f = random.nextInt(e-d+1)+d;
return f;
}
}
We are not allowed to put links in the answer to a question, so I have now put the link to a video explaining this code in the related links area.
wap to print all the arnstrong no. between 100&1000
how to write a program that counts automorphic number from 1 to 999
12
First of all we will describe how our program should be working.After entering number 1 and 5 I want it count 2 + 3 + 4 and return 9. After entering 4 and 9 it should count 5 + 6 + 7 + 8 and return 26. After entering X and X I should get 0. If I enter X and X - 1 I should get and error.Here is the code of such application:#include int main() {int firstNum, secondNum, sum, tmp;printf("Please enter first number: ");scanf("%d", &firstNum);printf("Please enter second number: ");scanf("%d", &secondNum);if (secondNum < firstNum) {printf("Sorry, second number must be higher than first one.\n");return 1;}sum = 0;for (tmp = firstNum + 1; tmp < secondNum; tmp++) {sum += tmp;}printf("All numbers between %d and %d sum equals %d\n", firstNum, secondNum, sum);return 0;}Testing:Please enter first number: 1Please enter second number: 5All numbers between 1 and 5 sum equals 9Please enter first number: 4Please enter second number: 9All numbers between 4 and 9 sum equals 26
find even number in array
wap to print all the arnstrong no. between 100&1000
program to find prime number in 8085 microprocessor
A program which is used to count the number of numbers in an array using a 8085 microprocessor is known as a assembly language program.
These are decimals and there are an infinite number of numbers between these numbers.
Prime numbers are numbers that are only divisible by themselves and the number 1. You can write a program to print all prime numbers from 1 to 100 in FoxPro.
There are no prime numbers in between these numbers. The only whole number between them is 6
There is no such thing as a "next" decimal number. Numbers are infinitely dense: that is, between any two numbers there are infinitely many numbers. Therefore, given any number claiming to be next after 65, there are infinitely many numbers between 65 and that number - The smallest of these has a better claim at being next. But there are infinitely many numbers between 65 and this number.There is no such thing as a "next" decimal number. Numbers are infinitely dense: that is, between any two numbers there are infinitely many numbers. Therefore, given any number claiming to be next after 65, there are infinitely many numbers between 65 and that number - The smallest of these has a better claim at being next. But there are infinitely many numbers between 65 and this number.There is no such thing as a "next" decimal number. Numbers are infinitely dense: that is, between any two numbers there are infinitely many numbers. Therefore, given any number claiming to be next after 65, there are infinitely many numbers between 65 and that number - The smallest of these has a better claim at being next. But there are infinitely many numbers between 65 and this number.There is no such thing as a "next" decimal number. Numbers are infinitely dense: that is, between any two numbers there are infinitely many numbers. Therefore, given any number claiming to be next after 65, there are infinitely many numbers between 65 and that number - The smallest of these has a better claim at being next. But there are infinitely many numbers between 65 and this number.
There need not be any prime number between them.
It is impossible to be in between one number.
There are an infinite number of rational numbers between these two numbers, but the only positive integer between these numbers is 6.
There are infinitely many numbers between any two different numbers. To find a number exactly in the middle between two numbers, calculate the average. That is, add the two numbers, then divide the result by 2.
It is the number halfway between them or half of the total of the two numbers, so 17 is the median.It is the number halfway between them or half of the total of the two numbers, so 17 is the median.It is the number halfway between them or half of the total of the two numbers, so 17 is the median.It is the number halfway between them or half of the total of the two numbers, so 17 is the median.It is the number halfway between them or half of the total of the two numbers, so 17 is the median.It is the number halfway between them or half of the total of the two numbers, so 17 is the median.It is the number halfway between them or half of the total of the two numbers, so 17 is the median.It is the number halfway between them or half of the total of the two numbers, so 17 is the median.It is the number halfway between them or half of the total of the two numbers, so 17 is the median.It is the number halfway between them or half of the total of the two numbers, so 17 is the median.It is the number halfway between them or half of the total of the two numbers, so 17 is the median.