+ 2

What's problem with this code ? I Need help

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); //your code goes here Scanner scanner1 = new Scanner(System.in); int hours=scanner1.nextInt(); int tothours=days*hours; Scanner scanner2 = new Scanner(System.in); int mins=scanner2.nextInt(); /*int hours=24; int tothours=days*hours; int mins=60;*/ long totmins=tothours*mins; long totsec=totmins*mins; } }

27th Feb 2022, 12:25 PM
Jayasree
4 Answers
+ 1
// There should be only one scanner defined / initialized. import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); //your code goes here //Scanner scanner1 = new Scanner(System.in); int hours=scanner.nextInt(); int tothours=days*hours; //Scanner scanner2 = new Scanner(System.in); int mins=scanner.nextInt(); /*int hours=24; int tothours=days*hours; int mins=60;*/ long totmins=tothours*mins; long totsec=totmins*mins; System.out.println(totmins); System.out.println(totsec); } }
27th Feb 2022, 1:08 PM
JaScript
JaScript - avatar
+ 1
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); //your code goes here /*Scanner scanner1 = new Scanner(System.in); int hours=scanner1.nextInt(); int tothours=days*hours; Scanner scanner2 = new Scanner(System.in); int mins=scanner2.nextInt();*/ int hours=24; int tothours=days*hours; int mins=60; long totmins=tothours*mins; long totsec=totmins*mins; System.out.println(totsec); } }
1st Mar 2022, 7:14 AM
Jayasree
+ 1
Thanks for helping meâ˜ș
1st Mar 2022, 7:15 AM
Jayasree
+ 1
You are welcome and happy coding.
1st Mar 2022, 11:57 AM
JaScript
JaScript - avatar