Finding the largest number
Hi, Can anyone please let me know where I went wrong with the Java code? I am getting memory exceeded message. Thanks import java.util.Scanner; class Largestnumber { public static void main(String[] args){ int a=0,b=0,c=0; int largest; Scanner X = new Scanner(System.in); System.out.println("Enter number for a"); a=X.nextInt(); System.out.println("Enter number for b"); b=X.nextInt(); System.out.println("Enter number for c"); c=X.nextInt(); if (a>b & a>c) largest =a; else if (b>a & b>c) largest =b; else largest =c; System.out.println("Largest is" +largest); } }