import java.util.Scanner;
public class bhatti {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int array[] = new int[10];
System.out.println("enter values you want to store in array: ");
for (int i = 0; i < array.length; i++) {
System.out.println("array[" + i + "]");
array[i] = input.nextInt();
if (array[i] > 9) {
System.out.println("ERROR, array should be less than or equal to 9");
return;
}
}
int i = 0;
int newarray;
int count;
while (i < array.length) {
newarray = array[i];
count = 0;
for (; i < array.length && newarray == array[i]; i++, count++)
;
System.out.println("array[" + count + "] " + newarray);
}
}
}
You got a 4.50% upvote from @postpromoter courtesy of @mehram!
Want to promote your posts too? Check out the Steem Bot Tracker website for more info. If you would like to support the development of @postpromoter and the bot tracker please vote for @yabapmatt for witness!
32 USD for non indented piece of java code. Earned in just one hour. Wow. Just wow.