Krishna Rajput Singh

Krishna Rajput Singh

  • NA
  • 4.9k
  • 5.1m

What is solution for this code please help

Aug 25 2020 12:30 AM
import java.util.Scanner;
public class Test
{
public void demo()
{
int num,n;
Scanner obj=new Scanner(System.in);
System.out.println("Enter a number");
num=obj.nextInt();
n=comp(num);
System.out.println("Your number is " +n);
}
public static int comp(int a)
{
return (a>0)? "positive" : "negative";
}
}

Answers (1)