Tama paps para isang call lang ngBale sa code mo. Hindi ko alam kung pwede iadd ang string or something concatenation
Ilagay mo yung value ng stk.pop sa isang string something sa loob ng while loop mo
binaryValue += stk.pop()
Sorry. C# programmer ako.
System.out.print(), I think need pa i-convert sa string before mag concat para tama ang value
.sir nag eeror pag nilagay ko sa isang variableYou already know how to do it (ASSUMING you're the one who created that program).
Look how you access FileWriter. You stored it in a variable. Why did you store it in a variable? So you can access it later. Same idea with .pop().
nag e error sirYou already know how to do it (ASSUMING you're the one who created that program).
Look how you access FileWriter. You stored it in a variable. Why did you store it in a variable? So you can access it later. Same idea with .pop().

import java.util.*;
public class HelloWorld{
public static void main(String []args){
int num = 12;
Stack<Integer> stk = new Stack<Integer>();
while(num != 0){
int res = num % 2;
stk.push(res);
num /= 2;
}
while(!(stk.isEmpty())){
System.out.println(stk.pop());
}
}
}