import java.util.*; class sample { public static void main(String[] args) { Scanner input = new Scanner(System.in); int x = 1; do { try { System.out.println("Enter first num: "); int n1 = input.nextInt(); System.out.println("Enter first num: "); int n2 = input.nextInt(); int sum = n1 / n2; System.out.println(sum); x = 2; } catch (Exception e) { System.out.println("You cant do that"); } } while (x == 1); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter