Computer Science, asked by Vermaruhi40, 11 months ago

Write a program to input any two numbers and print their sum and product by leaving two lines in between

Answers

Answered by AbhinSreekumar
27

Answer:

import java.util.*;

class basic

{

public static void main ()

{

System.out.println("Enter 2 numbers");

int m=t1.nextInt ();

int b=t1.nextInt ();

System.out.println("Sum=+"(m+b));

System.out.println ();

System.out.println ();

System.out.println ("Product="(m*b));

}

}

Answered by AskewTronics
7

Below are the program in python for the above question :

Explanation:

First_Number = int(input("Enter first number")) # print the message to input the first number and take input of first number and convert it into integer value.

Second_Number = int(input("Enter the second Number"))# print the message to input the second number and take input of second number and convert it into integer value.

print("The sum of the number is "+str(First_Number+Second_Number)) # print the sum of the number.

print("") # it is used to gives one line space.

print("") # it is used to gives one line space.

print("The product of the number is "+str(First_Number*Second_Number)) # print the product of the number.

Output:

  • If the user inputs 5 and 3 then the output is:  "The sum of the number is 8" and "The product of the number is 15" in a different line after giving two line space in between.
  • If the user inputs 4 and 3 then the output is:  "The sum of the number is 7" and "The product of the number is 12" in a different line after giving two line space in between.  

Code Explanation:

  • The first line and the second line of the code take the two inputs from the user and store it on "first_number" and "second_number" after converting it into an integer.
  • The second and third line of the code is to give the two line space between two print statement.
  • The fourth and fifth line of the program is to conclude the addition and multiplication of the number and prints after converting it into the string.

Learn More:

  • Python : https://brainly.in/question/8153418
Similar questions