-1

Hi every body

How to find smallest number and how many occurrence with the user input numbers until enter 0 ?

this my code .......

package javaapplication101;

import java.util.Scanner;

public class JavaApplication101 {
public static void main(String[] args) {
    int num = 0 , min = num ; int count=0;
Scanner input = new Scanner(System.in);


System.out.println("Enter a number : ");
 num=input.nextInt();

for(;;){
if(num==0)
break;

if (num < min && num >= 0)

min = num;



System.out.println("Enter a number : ");
num=input.nextInt();

}
System.out.println("The min number is : " + min );

System.out.println("The occurrence count of the min number is : " +  count);
}
}

Edited by Hussam Alahmadi: n/a

Votes + Comments
Duplicate post. OP not listening.
3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by stultuske
0

What are you doing?
This is a duplicate of your post 2 days ago, with exactly the same code mistakes, and completely ignoring the input you got from your previous post.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.