Java Programming
Would you like to react to this message? Create an account in a few clicks or log in to continue.


here you can ask help for your java related problems
 
HomeLatest imagesSearchRegisterLog in

 

 java count the occurance of number inside the offset

Go down 
AuthorMessage
Ak
Java Freak
Java Freak
Ak


Posts : 23
Join date : 2009-02-07

java count the occurance of number inside the offset Empty
PostSubject: java count the occurance of number inside the offset   java count the occurance of number inside the offset EmptyFri Apr 03, 2009 12:44 am

Code:

public class sample
{
  public static void main(String args[])
  {
      int num[]= {1,2,5,4,5,6,7,8,9,5};
      int index1, count = 0, find = 0;

      for(index1 = 0; index1 < num.length; index1++)
      {
        count = 0;
        for(int index2 = 0; index2 < num.length; index2++)
        {
            if(num[index2]==num[index1])
            {
              find = num[index2];
              count++;
            }
        }
        System.out.println("i found " + find + " " + count + " time(s) inside the offset");
      }

  }
}
Back to top Go down
https://javafreak.board-directory.net
 
java count the occurance of number inside the offset
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Java Programming-
Jump to: