write a java program to find sum, diffrence, product of 2 numbers using method with parameters and return type
Answers
Answered by
1
Answer:
import java.util.Scanner;
public class Computation
{
int sum,product,difference,average, quotient;
public static void main (String[] args)
{
Scanner sc=new Scanner(System.in);
int num1=sc.nextInt();
int num2=sc.nextInt();
sum=num1+num2;
product=num1*num2;
difference=num1-num2;
average=(num1+num2)/2;// this can also be //computed as sum/2
quotient=num1/num2;
System.out.println(“Sum is: “+sum);
System.out.println(“Difference is: “+difference);
System.out.println(“Product is: “+product);
System.out.println(“Average is: “+average);
System.out.println(“Quotient is: “+quotient);
}
}
Similar questions
Environmental Sciences,
23 days ago
English,
23 days ago
Math,
23 days ago
Environmental Sciences,
1 month ago
Environmental Sciences,
1 month ago
Social Sciences,
9 months ago
Chemistry,
9 months ago
Science,
9 months ago