Computer Science, asked by sudharsansd8055, 7 months ago

Write a program to read two numbers ,add it and display use Scanner class read input​

Answers

Answered by himajagullipalli
1

Answer:

  1. Important java. util. scanner;
  2. public class Input functions {
  3. public static void main (String[ ] args) {
  4. Scanner readme = new scanner (System.in) ;
  5. System. out. print In(" Enter Two numbers (Press Enter after each)
  6. // two variables to hold numbers
  7. double n1, n2, n3;
  8. n1 = readme. nextDouble( ) ;
  9. n2 = readme. nextDouble ( ) ;
  10. n3 = n1 + n2;
  11. System. out. print In ("Total = " + n3) ;
  12. }
  13. }
Similar questions