import java.util.Scanner; public class BMI { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String first_name; int kg; double height; double bmi; for(int i=1; i<4; i++) { System.out.print("NAME "); first_name=scanner.next(); System.out.print("WEIGHT, kg"); kg=scanner.nextInt(); System.out.print("HEIGHT, m"); height=scanner.nextDouble(); bmi= kg / (height * height); System.out.printf("%s %20s %20s %20s", "NAME", "Weight", "Height", "BMI"); System.out.println(); System.out.printf("%-10s %12d %21.2f %22.2f",first_name,kg,height,bmi); System.out.println(); } } }
how can I make this data to be brought to one table at the end,not so separately,without array. I've had a issues
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)