HELP this code run on DR.JAVA app but not on sololearn playground. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

HELP this code run on DR.JAVA app but not on sololearn playground.

import java.util.Scanner; class CALCULATOR{ public static void main(String[]made_by_Himanshu){ System.out.println("Enter The First Number = "); Scanner scan1 = new Scanner(System.in); double number_1=scan1.nextDouble(); System.out.println("Enter The Second Number = "); Scanner scan2 = new Scanner(System.in); double number_2=scan2.nextDouble(); System.out.println("Enter O for ADDITION, 1 for SUBSTRACTION, 2 for MULTIPLICATION and 3 for DIVISION"); Scanner scan=new Scanner(System.in); int operate=scan.nextInt(); if(operate<1){ System.out.println(number_1+number_2); }else if(operate>0&&operate<2){ System.out.println(number_1-number_2); }else if(operate>1&&operate<3){ System.out.println(number_1*number_2); }else if(operate>2&&operate<4){ System.out.println(number_1/number_2); } } }

6th Jul 2020, 8:09 AM
Himanshu
Himanshu - avatar
0 Answers