0

How to fix it

import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // take input from the user System.out.print("Enter Your Weight: "); float a = sc.nextInt(); // take input from the user System.out.print("Enter Your Hight: "); double b = sc.nextInt(); double c = b*0.3048; double d = c*c; double e = a/d; sc.close(); System.out.println(e + " is odd"); } }

25th Feb 2022, 12:13 PM
Md Fihad Hossain
Md Fihad Hossain - avatar
2 Answers
+ 1
float a = sc.nextInt(); double b = sc.nextInt(); you take int from user and store it to float and double why, once user input decimal value at (a) or (b) it will throw an error. what do u want to do or what do u want to fix?
25th Feb 2022, 12:33 PM
Mohamed
Mohamed - avatar
+ 1
https://www.sololearn.com/learning/2220/ nextInt(), nextDouble(), nextFloat()
25th Feb 2022, 12:36 PM
Mohammed