0

What the mistake ????

import java.util.*; //java calculator buttons public class Program { public static void main(String[] args) { Scanner s=new Scanner (System.in); int a=s.nextInt(); char c=s.next(); int b=s.nextInt(); int sum=a+b; int dif=a-b; int mul=a*b; int div=a/b; int remain=a%b; switch(c){ case'+':System.out.println("Addition = "+sum); break; case'-':System.out.println("Subtraction = "+dif); break; case'*':System.out.println("Product = "+mul); break; case'/':System.out.println("Quotient = "+div); break; case'%':System.out.println("Remainder = "+remain); break; default :System.out.println("Invalid operation"); } } }

14th Jan 2023, 10:25 AM
Suraj
Suraj - avatar
4 Respuestas
+ 1
Save code and share link here.. Mention the problem you getting by this code ...!!
14th Jan 2023, 10:28 AM
Jayakrishna 🇮🇳
+ 1
suraj Choudhary It sometimes depends on your try so mention your error or trouble.. In your program, replace char c=s.next(); with char c=s.next().charAt(0);
14th Jan 2023, 11:20 AM
Jayakrishna 🇮🇳
0
Please find
14th Jan 2023, 10:30 AM
Suraj
Suraj - avatar
14th Jan 2023, 11:10 AM
SoloProg
SoloProg - avatar