strong textHello.
So the following the code which works absolutely fine in netbeans but when I upload on CODECHEF, it shows COMPILATION ERROR. Plz help. I want to know where am I wrong while copying the code so that I can amend it and go for further codes.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int l,b;
System.out.println("Enter length and breadth: ");
l=in.nextInt();
b=in.nextInt();
float area, peri;
area = l*b;
peri = 2*(l+b);
if(area>peri){
System.out.println("Area");
System.out.println("Area="+area);
}
else
System.out.println("Perimeter");
System.out.println("Perimeter"+peri);
Sorry to trouble again, but this time I *uploaded with Scanner in = new Scanner(); and it showed wrong. without scanner also it shows compilation error.
what should i write/change?
class Main {
public static void main(String[] args) {
int l,b;
float area, peri;
area = lb;
peri = 2(l+b);
if(area>peri){
System.out.println(“area”);
System.out.println(area);
}
else
System.out.println(“Peri”);
System.out.println(+peri);
} }