+ 1
Please tell me how to program to add a two numbers from a user's input in java?
Adding two numbers from user's input in java
13 ответов
0
Please see this code also..and comment it...
I try this code based on my question with the help of SoloLearners...
I hope this code may be answer for my question shown above....
Thanks for those SoloLearners guidance......😃😃
https://code.sololearn.com/c6CWh7dG59Z4/?ref=app
+ 2
James Clark I. Vinarao
I think providing complete code is not good.As if someone complete half of java course than he have such knowledge to solve this kind of problem by using the learned knowledge.
And secondly he was asking for addition of two numbers by user input not by hard coded values.
+ 2
Martin Taylor thanks in my next code onwards I will make sure to rectify these corrections...
Any ways thanks again for your guidance .....
+ 2
You can see this tutorial I hope so you will get your answer.....
https://code.sololearn.com/c4I400c9D4As/?ref=app
+ 1
First complete your java tutorial course than you can answer your question yourself in much better way.
0
My attempt please see this code and comment it.It not related to adding but related to squaring the numbers...
and
Thanks for your guidance...☺☺
https://code.sololearn.com/cI2i5D5gm1Wk/?ref=app
0
Thank you Martin Taylor 😊😊
0
Public class Add
{
Public static void main (String arts[])
Scanner s= new Scanner(System.in);
System.out.println("enter a,b values:");
Int a=s.nextInt();
Int b=s.nextInt();
Int c;
c=a+b;
System.out.println(c);}
0
Public class Add
{
Public static void main (String [ ] args)
{
Scanner s= new Scanner(System.in);
System.out.println("enter a,b values:");
Int a=s.nextInt();
Int b=s.nextInt();
Int c;
c=a+b;
System.out.println("the sum is" + c);
}
}
- 3
Don't be discouraged. Here is how:
public class AddTwoNumbers {
public static void main(String[] args) {
int num1 = 5, num2 = 15, sum;
sum = num1 + num2;
System.out.println("Sum of these numbers: "+sum);
}
}