class Q3 { public static void main(String[] args) { int x = 13; int y = 6; // int a = 0; int b = x; int c = y; while (b > 0) { if (b%2==1) a += c; b /= 2; c += c; } System.out.println("Result = "+a); } }