int a = 10;

int b = 5;

int remainder = a % b;

if ( remainder != 0)

if ( remainder == 1)

System.out.print(a);

else

System.out.print(b);


Answer: ______________________


What would be the answer I'm super confused

Respuesta :

Answer:

System output is nothing

Explanation:

int a = 10;

int b = 5;

int remainder = a % b;

if ( remainder != 0)

      if ( remainder == 1)

           System.out.print(a);

      else

           System.out.print(b);

a%b result is 0 so it will not go into the any of the if statements and exit without printing anything. Please try the below C++ program then you will see.

#include <iostream>

using namespace std;

int main ()

{

   int a = 10;

   int b = 5;

   int remain = a % b;

   if ( remain != 0)

        if ( remain == 1)

             cout<<a;    

        else

             cout<<b;

   return 0;

}