This is the code snippet for a basic add program by getting the user input.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class BacisCalc { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
double fnum,snum,answer; | |
System.out.println("Enter the First number: "); | |
fnum = sc.nextDouble(); | |
System.out.println("Enter the Second number: "); | |
snum = sc.nextDouble(); | |
answer = fnum + snum; | |
System.out.println(answer); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enter the First number: | |
53.5 | |
Enter the Second number: | |
65.9 | |
119.4 |
No comments:
Post a Comment