I just took this tutorial course and I am stuck at it. The code is running perfectly on my local machine, but it's giving me either 'wrong', 'compilation error', 'NZEC' errors in IDEONE and I am not sure what to do. I tried coding it in Java, but then I tried Python. The Python snippet even worked on Ideone, but still when I submit the solution, it's giving me error. Can somebody please go through both of my snippets and guide me how to submit solutions here? Thankyou
JAVA:
import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
try {
//get c,k,w
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
//Scanner reader = new Scanner(System.in);
int t, c, k, w = 0;
System.out.println("Enter No. of tries: ");
t = Integer.parseInt(reader.readLine());
while (t > 0 ) {
System.out.println("Enter No. of cats: ");
c = Integer.parseInt(reader.readLine());
System.out.println("Enter No. of KGs: ");
k = Integer.parseInt(reader.readLine());
System.out.println("Enter Weight of the Donughts: ");
w = Integer.parseInt(reader.readLine());
if (c*w <= k)
System.out.println("yes");
else
System.out.println("no");
t--;
}
} catch (Throwable trh) {
System.out.println("NumberFormatException" + trh.toString());
}
}
}
PYTHON:
t = input ("Enter No. of tries: ")
while (t >0):
c = input ("Enter No. of cats: ")
k = input ("Enter No. of KGs: ")
w = input ("Enter No. of Weight: ")
if(c*w <= k):
print "yes"
else:
print "no"
t = t -1