Computer Science, asked by ritwik16, 1 year ago

write an application that reads two floating point numbers and print their sum difference and product. plzzzz do it 5 qstn

Attachments:

mrOogway: I am confused

Answers

Answered by digi18
6
public class Arithmetic {

public static void main (String [] args){

Float a,b,sum,diff,product;

Scanner sc = new Scanner (System.in);

System.out.println("Enter a : ");

a = sc.nextFloat ();

System.out.println("Enter b : ");

b = sc.nextFloat ();

sum = a + b;
diff = a - b;
product = a * b;

System.out.println("Sum = ",+sum);

System.out.println(" Difference = ", +diff);

System.out.println("Product =",+product);

System.out.println(" ");

System.out.print("Thanks and plz mark brainliest.");

}

}


OUTPUT

Enter a:
2.0
Enter b:
1.0
Sum=3.0
Difference=1.0
Product=2.0

Thanks and plz mark brainliest

Answered by kripaparma
0

Answer:

Explanation:

import java.util.Scanner;

class Main

{

public static void main(String[] args)

 {

   Scanner scan = new Scanner(System.in);

    System.out.print("Number 1 ");

    double one = scan.nextDouble();

   System.out.print("Number 2 ");

   double two = scan.nextDouble();

   System.out.println(one + two);

   System.out.println(one - two);

   System.out.println(one * two);

}

}

Similar questions