Create a 10 element integer array and store some integer values display as the counting of 0.
public class JavaEx { public static void main(String args[]) { int numbers[] = {10,15,0,0,6,0,0,1,6,4}; int x,count,len; count = 0; len = numbers.length; for(x= 0; x < len; x++) { if(numbers[x]==0) { System.out.println(numbers[x]); count++; } } System.out.println(count); } }
above examples int numbers[] = {10,15,0,0,6,0,0,1,6,4}; here there is 4 zeros.
Output display as
0 0 0 0 4
Laravel Print Version: An Essential Guide Laravel is a powerful PHP framework widely used for…
Laravel cache clear , you can use the Artisan command-line tool that comes with Laravel.…
Vue.js is a powerful JavaScript framework for creating dynamic user interfaces, while Laravel is a…
In Java, a void function (or method) does not return any value. However, you can use the return statement…
Generating Random Numbers with Weights in Java Random number generation with weighted probabilities is a…