Forum : output error
Brief description  about Online courses   join in Online courses
View nishant  gaurav 's Profile

output error

import java.io.*;
class evenodd
{
public static void main(String[] args) throws IOException
{
int m,n,p,k;
System.out.println("enter the value of m and n");
BufferedInputStream b=new BufferedInputStream(System.in);
m=(int)b.read();
System.out.println(m);
BufferedInputStream c=new BufferedInputStream(System.in);
n=(int)c.read();
System.out.println(n);
p=m n;
System.out.println("added result is" p);
k=p%2;
if (k==0)
{
System.out.println("resulted number is even");
}
else
{
System.out.println("resulted number is odd");
}
}
}
the coding is working but gives absurt result
Asked by nishant gaurav | Jul 30, 2010 |  Reply now
Replies (2)
View arun kumar das 's Profile
Hi Nishant,

Did the code work after implementing change specified by Pradeep?

Regards,
JT
Aug 4, 2010
View pradeep purushothaman 's Profile
p=m n; should be p=m+n;
Jul 30, 2010