Hannah is planning to set up a garden in her terrace. First she wants to know how many pots can be kept in her terrace before she buys the saplings and seeds.
Help her to set up her terrace garden.
Enter the area of the terrace in square feet and the diameter of the pot in inches.
If area or diameter is zero or negative display "Invalid Input". If diameter greater than area display "Invalid Input".
java code for this!
Answers
Answered by
0
Answer:
Explanation:
import java.util.Scanner;
class garden
{
public static void main(String[]args)
{
int area;
Scanner in=new Scanner(System.in);
System.out.println("Enter the length of the terrace");
int l = in.nextInt();
System.out.println("Enter the breadth of the terrace");
int b = in.nextInt();
area = l * b
System.out.println("Area:" + area);
System.out.println("Enter the diameter of the pot");
int d = in.nextInt();
if(d<=0)
{
System.out.println("Invalid Input");
}
else if(d>area)
{
System.out.println("Invalid output");
}
}
}
Similar questions
Math,
4 months ago
Physics,
9 months ago
Math,
9 months ago
Social Sciences,
1 year ago
Social Sciences,
1 year ago