presentation error

Rodrigo Vargas asked 1 year ago

Yeah presentation error, dunno where, if someone can explain pretty much appreciated

         Scanner e= new Scanner(;

int a=e.nextInt(); int b=e.nextInt(); int c=e.nextInt(); int d=e.nextInt(); int prod= (ab-cd); System.out.printf("DIFERENCA = "+prod);

Remember not post solutions. Your post may be reviewed by our moderators.

  • ESTER MABEL SILVA SANTOS replied 1 year ago

    For what I could understand, you want to make the difference between two products that were originated by four variables. The mistakes on your code were the spaces between the commands and also on the equation you didnt put the "*" that stands for multiply and the correct parenthesis so the equation works. I did it this way, I just took your code and corrected what I thought it was wrong, it worked on my tests.

    Hopefully I was helpful... :))

    Scanner e= new Scanner(;
            int a = e.nextInt(); int b = e.nextInt(); int c = e.nextInt(); int d = e.nextInt(); 
            int prod= ((a * b) - (c * d)); 
            System.out.printf("DIFERENCA = "+ prod);