- 1
Write a program to add 2 numbers A) initialised by yourself B) take user input using scanner class
Java
2 Réponses
+ 4
Have you started learning java if not then read about the data types and input statement about scanner class.
Simply declare two variables depends on the data type for example for integer u can write like this
int a,b;
Then u need to ask for user input so for this u need to import scanner class then
Write like this
Scanner sc= new Scanner (System.in);
a=sc.nextInt() ; // this is for input one
Same do for other number and use print statement to print the output
+ 2
Hello Kritika Kohli
Please show us your attempt.