Page 506 - computer science (868) class 11
P. 506
22 {
23 System.out.print(binaryVal[i]);
24 }
25 }
26
27 void dec2oct(int num)
28 {
29 int octalVal[] = new int[32];
30 int num1=num;
31 while (num > 0)
32 {
33 octalVal[counter++] = num % 8;
34 num = num / 8;
35 }
36 System.out.print("Octal Value of " + num1 + " : " );
37 for (int i = counter - 1; i >= 0; i--)
38 {
39 System.out.print(octalVal[i]);
40 }
41 }
42
43 void dec2hex(int num)
44 {
45 String hexVal = "";
46 int dig; // to store digits
47 int num1=num;
48 while (num > 0)
49 {
50 dig = num % 16;
51 switch (dig)
52 {
53 case 15: hexVal += "F"; break;
54 case 14: hexVal += "E"; break;
55 case 13: hexVal += "D"; break;
504504 Touchpad Computer Science-XI

