+ 2
What is the wrong whith this program???? PLEASE ANSWER???
public class Program { public static void main(String[] args) { int a,b,c; Scanner in = new Scanner(System.in); System.out.println("Eneter any two no."); a=in.nextint(); b=in.nextInt(); c=a+b; System.out.println("Add "+c); } }
2 Answers
+ 4
Other than there isn't an import for Scanner and no output for the result, the code is perfectly valid. Try:
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
System.out.println("enter the no.");
int a,b,c;
Scanner s = new Scanner (System.in);
a=s.nextInt();
b=s.nextInt();
c=a+b;
System.out.println(c);
}
}
edit:
lol you changed it, so now just the import.
+ 2
thanks bro. i am try without import ...đđđ
so thanks ....đđđ