Ineed helppp | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

Ineed helppp

Write a java program that reads 10 integer number in the range 0 to 100 from the user and then prints the smallts and largest numbers

13th Nov 2020, 5:44 PM
Nuha
Nuha - avatar
5 Answers
+ 1
Please attach your try
13th Nov 2020, 5:58 PM
Benjamin Jürgens
Benjamin Jürgens - avatar
+ 1
public class Program { public static void main(String[] args) { // } here you are closing main function,you should write all code in main method so remove these 2 braces .. //} Scanner nda = new Scanner(System.in); //to work this, you need to import Scanner class in first lines int x; int i=1; for (;i>=10;i++ ){ //condition i>=10 i.e 1>=10 is false at 1st time. It should be i<=10... System.out.println("Enter an integer numbers#"+i+"between 0 to 100"); x = nda.nextInt(); if (x>=0&&x<=100) { //here write the code to find min and max value fir that first take min ,max variables and assign -Infinity and infinity to it intiallally or min=100,max=-1 also works here simply... } else { System.out.println("invalid input !! not in the range!!"); } } } } //try these and reply if you need any.. Nuha
13th Nov 2020, 6:55 PM
Jayakrishna 🇮🇳
0
this is my try
13th Nov 2020, 6:35 PM
Nuha
Nuha - avatar
0
Hope you can correct your code.. Instead of ..... in tag, add appropriate tags like language name " java ".
13th Nov 2020, 7:30 PM
Jayakrishna 🇮🇳