Write a program to count the occurrence of 1 and print it's position of a number which is converted to binary number. import java.util.*; public class DigitCount { public static void toBinary(int decimal){ int binary[] = new int[100]; int index = 0; while(decimal > 0){ binary[index++] = decimal%2; decimal = decimal/2; } int count = 0, lo=0; int loc[] = new int[100]; for(int i = index-1;i >= 0;i--){ if(binary[i] == 1) { count += 1; loc[lo++]=i; ...
CodeInStack
java,c,c++,coding,college all java, c and c++ codes, makaut codes, wbut codes