Can we write this code even better....???
I working on Scientific calculator project User can give as many as inputs for a particular Aurthamatic operation I separately testing this code import java.util.Scanner; public class Program { public static void main(String[] args) { int a,b; Scanner Sc = new Scanner(System.in); a = Sc.nextInt(); b = Sc.nextInt(); a = a + b; System.out.println(a); while(a>0) { try { b = Sc.nextInt(); } catch (Exception e) { System.out.println("Input terminated"); break; } a = a + b; System.out.println(a); } } } I felt it's better to ask you guys "how I turn this code even better , I want ur suggestions... 🤗