im tiring to create a program that will receive 10 int arrays
and if tow numbers are equal i need to print them only once
example
{125161548}
{125648}
Printable View
im tiring to create a program that will receive 10 int arrays
and if tow numbers are equal i need to print them only once
example
{125161548}
{125648}
Cool! Do you have a question?
??
i don't knew how the check if the num are equal
??????
How would you do it on a piece of paper?
on eclipse
public class Ex7Qu3 {
public static void main(String[] args) {
int num3;
int[] num1 = new int[10];
for (int i = 0; i < num1.length; i++) {
num1[i] = (int) (Math.random() * 10);
System.out.print(num1[i]);
Wow, when I do that on a piece of paper, I'd take the first number and print it, then strike all other occurances of that number, then I'd take the next number and do the same with that one. But that might just be me.
Yeah, I think I'd just take a look just before I wrote it down to see if it's on the list of numbers I've written down already.
-Gary-
Yup, that's possible too, just that you cannot really look what you have written from a program, unless you've stored the written numbers somewhere ;)
code please :)
No. This forum isn't for other people to do your homework for you. You've actually gotten two completely valid and helpful answers in this thread already.
Quote:
Wow, when I do that on a piece of paper, I'd take the first number and print it, then strike all other occurances of that number, then I'd take the next number and do the same with that one. But that might just be me.
Writing the code is your job. Show us your best effort, and we may be able to help you find your mistakes.Quote:
Yeah, I think I'd just take a look just before I wrote it down to see if it's on the list of numbers I've written down already.
-Gary-
EDIT: what Gary said.