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