Fruit ball with java solution | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Fruit ball with java solution

Please find the error import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int fruit = sc.nextInt(); System.out.println(fruit ℅ 4) } }

14th Oct 2020, 5:19 AM
Manash Saikia [ 45% Active ]
Manash Saikia [ 45% Active ] - avatar
1 Answer
0
Please study the code.. import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner ti=new Scanner(System.in); int nofruit=ti.nextInt(); if(nofruit/2!=0) { int apples=(nofruit/2); int pie=apples/3; System.out.println(pie); }else System.out.println(0); } } If any questions let me know ill help
11th Nov 2022, 4:34 PM
Isuru
Isuru - avatar