write a program to add two numbers. TAKE two numbers as input
its Java
plz do it
Answers
Answered by
1
Explanation:
Full Code
- //import java.util.Scanner;
- public class Inputfunctions {
- public static void main(String[] args) {
- Scanner readme = new Scanner(System. in);
- System. out. println("Enter Two Numbers (Press Enter after each):");
- //two variables to hold numbers.
- double n1, n2, n3;
- n1 = readme. nextDouble();
Answered by
0
Answer:
import java.util.*;
public class HelloWorld{
public static void main(String []args){
int a,b,c;
Scanner sc=new Scanner(System.in);
System.out.println("enter the first number");
a=sc.nextInt();
System.out.println("enter the second number");
b=sc.nextInt();
c=a+b;
System.out.println("sum of these numbers:"+c);
}
}
Output
enter the first number 5
enter the second number 6
sum of these numbers 11
Similar questions
Math,
4 months ago
Computer Science,
4 months ago
English,
4 months ago
Social Sciences,
9 months ago
Social Sciences,
9 months ago
Science,
1 year ago
English,
1 year ago