Computer Science, asked by akshayvichu00743, 1 month ago

write a java program to find sum, diffrence, product of 2 numbers using method with parameters and return type

Answers

Answered by manjubadola1
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