# what the wrong in my program ><

• 05-03-2010, 11:53 AM
MSs.Java
what the wrong in my program ><
hi every one :)
I am still having begun in Java ;)

and i hav this sheet I wrote the program But there are mis-outputs :confused::confused:

That is the question
Quote:

Write a program to read N integers , then find and print the following :
1- Count numbers between 3 and 10.
2- Count numbers divisible by 5.
3- Count numbers divisible by 10.
4- Largest number.

Quote:

import java.util.*;
public class try1
{
public static void main (String []args )
{
Scanner console=new Scanner(System.in);

int n1=0,n=0 , n2 =0,n3=0,count ;
double larg = 0, small=0,divi, max ;

System.out.println("entar N intgar number " );
n1 = console.nextInt();

max = n1 ;

for ( n1= 10 ; n1>3 && n1<10 ; n++);
{
n1 = console.nextInt();

System.out.println("1- Num between 3 and 10 :" +" "+ "count"+ " " + n);
}

if (n1 %5 == 0 )
{
n2 ++ ;
System.out.println(" Num 5-divisibles :Count =" + " " + n2 );

}

if (n1 %10 == 0 )
{
n3 ++ ;
System.out.println(" Num 10 -divisibles :Count =" + " " + n3 );

}

for ( count = 1 ; count <10 ; count++);
{
n1 = console.nextInt();

if (n1 >max)
max= n1 ;
else
max = max ;
System.out.println(" the large number " + " " + max );

}

}
}

can any one help me :o
• 05-03-2010, 12:01 PM
PhHein
Id say you should use a List to store the numbers. Then you need to have a few methods to calculate the values.
• 05-03-2010, 12:03 PM
dswastik