package com.twisters;
import java.util.Scanner;
public class SubtractFloat{
public static void main(String args[]){
float a,b,result;
System.out.print("Enter the first num : ");
a = new Scanner(System.in).nextFloat();
System.out.print("Enter the second num : ");
b = new Scanner(System.in).nextFloat();
result = a + (~0)*b; //alternately we can use cos(PIE) instead of ~0
to generate -1
System.out.println("Result of subtracting is : "+result);
}
}
Sorry no correct answers this week!
No comments:
Post a Comment
Solution for this question?