java - Are my loops preventing me from getting the expected output? -


my goal determine, pair of integers, whether second integer multiple of first. code follows:

import java.util.scanner;      public class multiples {          public static void main(string [] args) {              boolean run = true;              while(run) {                  scanner input = new scanner(system.in);                  system.out.print("enter 1 number:");                 int num1 = input.nextint();                 system.out.print("enter second number:");                 int num2 = input.nextint();              boolean result = ismultiple(num1, num2);              if(result) {                 system.out.println(num2 + " multiple of " + num1);              } else {                 system.out.println(num2 + " not multiple of " + num1);              }                  system.out.print("do want enter pair(y/n)?");                 run = yesorno(input.next());             }                 }              public static boolean yesorno(string a) {                  if(a.equals("y"))                     return true;                 else                     return false;             }               public static boolean ismultiple (int x , int y) {                  if(y % x == 0)                      return true;                     else                      return false;              }               } 

this output: enter image description here

this expected output: enter image description here

the expected output confusing me.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -