Sorry for such a basic question. But I'm starting to program. Not a computer guy. So kindly help me. In this code, when I give input 1000000000, 1000000000, 999999999the answer should be 4. But my answer is 1. I expect that the operator ifwill be executed, but he is not satisfied here.
if you take m * n as a room and "a" as a square tile. Then I want to take MINIMUM no. from tiles it is necessary to fill the floor of the room. the tile may cover a little more area, but should not leave the room empty. it is my goal. It works with inputs like 6,6,4 or 15,20,13 etc.
Now its working guys. I posted the correct code with these minor changes below.
import java.util.Scanner;
public class TheatreSquare {
private static Scanner input;
public static void main(String[] args) {
input = new Scanner(System.in);
float m=input.nextFloat();
float n=input.nextFloat();
float a=input.nextFloat();
long i=(int)(m/a);
long j=(int)(n/a);
if((a*a*i*j)<m*n){
if(a*i<m){
System.out.println("true");
i+=1;
}
if(a*j<n){
System.out.println("false");
j+=1;
}
}
System.out.println((double)(i*j));
}
}