Wednesday, June 16, 2021

Java program that reads in two floating-point numbers and tests whether they are the same or different (Java) (183)

package com.company;
import java.util.Scanner;
public class Program20 {
public static void main(String[] args) {
Scanner put = new Scanner(System.in);
System.out.println("please enter a first float number:");
float a=put.nextFloat();
System.out.println("please enter a second float number:");
float b=put.nextFloat();
if(a==b)
{
System.out.println("you enter same floating point number");
}
else
{
System.out.println("you enter different numbers");
}

}
}

No comments:

Post a Comment