+ 1

1.How to add a feature that will collect custom input. 2.How to convert double to int

I want to solve the problem of "financial calculus https://code.sololearn.com/ch2pjH47aHix/?ref=app

14th Jan 2021, 2:47 PM
‎ Герман Папанов(הרמן פפנוב)‎
‎ Герман Папанов(הרמן פפנוב)‎ - avatar
2 ответов
+ 6
You can see list of input methods for different types here : https://www.sololearn.com/learn/Java/2220/ Btw it would be good if you recheck the for loop lesson. https://www.sololearn.com/learn/Java/2147/?ref=app
14th Jan 2021, 3:00 PM
Simba
Simba - avatar
- 1
public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); float inp = sc.nextFloat(); int n = (int) inp; System.out.print(n); } } use scanner class for input and see "int n = (int) inp;" to convert float in int
14th Jan 2021, 3:03 PM
Ayush Kumar
Ayush Kumar - avatar