Hola...! Friends( ╹▽╹ )
Q. Write a program in java to add and multiply two numbers .
Please don't Spam here ❌❌
Answers
Using Scanner class
import java.util.*;
public class AddMultiply
{
public static void main(String[]args)
{
Scanner scan = new Scanner(System.in);
int a,b;
System.out.print("Enter first no. :");
a=scan.nextInt();
System.out.print("Enter second no. :");
b=scan.nextInt();
int add=a+b;
int multiply=a*b;
System.out.println("Addition of two no. :"+add);
System.out.println("Multiplication of two no. :"+multiply);
scan.close();
}
}
Without using scanner class
public class AddMultiply
{
public static void main(int a, intb)
{
int add=a+b;
int multiply=a*b;
System.out.println("Addition of two no. :"+add);
System.out.println("Multiplication of two no. :"+multiply);
}
}
Mark me brainliest :)
Explanation:
Case 1 if u have to multiply two numbers
start is in Ellipse
then down arrow
read A is in parallelogram
then down arrow
read B is in parallelogram
then down arrow
multiply=A×B is in rectangle
then down arrow
print is in parallelogram
then down arrow
CASE 2 if u have to add two numbers
start is in Ellipse
then down arrow
read A is in parallelogram
then down arrow
read B is in parallelogram
then down arrow
sum=a+b is in rectangle
then down arrow
print is in parallelogram
then down arrow
![](https://hi-static.z-dn.net/files/d7e/c1a71bfb0de3ee26830124e93e6f1d5e.jpg)
![](https://hi-static.z-dn.net/files/dd2/3c2d19bead24126a9fc568cc8334ebce.jpg)
![](https://hi-static.z-dn.net/files/d62/19a6b8a03c81f2397930504b62a3c1c7.jpg)
![](https://hi-static.z-dn.net/files/d35/3f338c6287caf59a0b274f68bc945c91.jpg)