|
-
December 1st, 2005, 12:22 PM
#1
need help with this program please
I been trying since sunday to get this program to work but I keep hitting the wall it is due today and I still dont have it working please help. The program is suppossed to use an array to store 5 numbers entered by the user. If the number is under 10 or over 100 it doesn't print. If the number is the same it doesn't print. Here is my code please help.
import java.util.Scanner;
import java.util.*;
public class Arrays{
public static void main( String args[])
{
int number;
int counter = 0;
int []list;
list=new int[5];
int i=0;
for (i=0; i < list.length;i++)
{
Scanner myInput=new Scanner( System.in );
System.out.println("Enter a number:");
list[i]= myInput.nextInt();
if (i < 10 || i > 100)
{
i=0;
}
if (i==i)
{
i=0;
}
else
{
list[i]=myInput.nextInt();
}
System.out.printf( "Your numbers are: %d\n",list[i]);
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|