.Write an algorithm to print the table of 2 up to 5.
Condition:
We don’t want to print line “2 x 4 = 8”
Example:
Input
number = 2
Output
2 x 1 = 2
2 x 2 = 4
2 x 3 = 6
2 x 5 = 10
Answers
Answered by
0
Answer:
import java.util.*;
public class Main
{
public static void main(String[] args) {
int[] arr = new int[10];
Scanner sc = new Scanner(System.in);
System.out.println("Enter all 10 numbers:");
for(int i = 0; i < 10; i++){
arr[i] = sc.nextInt();
}
Arrays.sort(arr);
System.out.println("The smallest number is " + arr[0]);
}
}
Explanation:
Similar questions