Import Public Class Exercise1: Java Util Scanner
Import Public Class Exercise1: Java Util Scanner
Import Public Class Exercise1: Java Util Scanner
Scanner;
if (input > 0)
System.out.println("Number is positive");
System.out.println("Number is negative");
else
System.out.println("Number is zero");
Copy
Sample Output:
Input number: 35
Number is positive
Flowchart:
Improve this sample solution and post your code through Disqus
Form Template
by Taboola
Sponsored Links
Iloilo is actually full of single guys. Check them out on this premium
dating siteDating.com
©w3resource.com 2011-2020
Privacy
About
Contact
Feedback
Advertise
import java.util.Scanner;
System.out.print("Input a: ");
double a = input.nextDouble();
System.out.print("Input b: ");
double b = input.nextDouble();
System.out.print("Input c: ");
double c = input.nextDouble();
} else {
Copy
Sample Output:
Input a: 1
Input b: 5
Input c: 2
The roots are -0.4384471871911697 and -4.561552812808831
Flowchart:
Java Code Editor:
Form Template
©w3resource.com 2011-2020
Privacy
About
Contact
Feedback
Advertise
import java.util.Scanner;
Copy
Sample Output:
Input the 1st number: 25
Input the 2nd number: 78
Input the 3rd number: 87
The greatest: 87
Flowchart:
Java Code Editor:
Previous: Write a Java program to solve quadratic equations (use if, else if and
else).
Next: Print a floating-point number in a specified format
Form Template
Sponsored Links
Iloilo is actually full of single guys. Check them out on this premium
dating siteDating.com
Copy
Sample Output:
©w3resource.com 2011-2020
Privacy
About
Contact
Feedback
Advertise