Write a program to read two numbers ,add it and display use Scanner class read input
Answers
Answered by
1
Answer:
- Important java. util. scanner;
- public class Input functions {
- public static void main (String[ ] args) {
- Scanner readme = new scanner (System.in) ;
- System. out. print In(" Enter Two numbers (Press Enter after each)
- // two variables to hold numbers
- double n1, n2, n3;
- n1 = readme. nextDouble( ) ;
- n2 = readme. nextDouble ( ) ;
- n3 = n1 + n2;
- System. out. print In ("Total = " + n3) ;
- }
- }
Similar questions
Computer Science,
3 months ago
Business Studies,
7 months ago
Science,
7 months ago
English,
11 months ago
Biology,
11 months ago
Science,
11 months ago