0
Can anyone help me with this code, it is throwing input mismatch error.
import java.util.Scanner; public class Program { public static void main(String[] args) { int popsicles,siblings; Scanner Myvar = new Scanner(System.in); System.out.println("Enter the no. of Popsicles"); popsicles = Myvar.nextInt(); System.out.println("Enter the no. of siblings"); siblings = Myvar.nextInt(); if(popsicles> siblings || popsicles%siblings!=0){ System.out.println("Eat them yourself"); } else{ System.out.println("Give Away"); } // System.out.println(popsicles); } }
2 Antworten
+ 3
Enter two integers as input, it should work just fine. On a different note, the first condition is supposed to be popsicles < siblings 😌
+ 1
Thank you Shamima Yasmin 😊