Computer Science, asked by jaishankarraj, 10 hours ago

write a program in java to assign any two value and print the multiplication division and remainder as per following format
Assign: p=4;
q=2;
output: multiplication =8
division =2
remainder =0​

Answers

Answered by SpandanMukherjee428
1

Answer:

public class Main {

   public static void main(String[] args) {

       int p = 4;

       int q = 2;

       System.out.println("Multiplication : " + p*q);

       System.out.println("Division : " + p/q);

       System.out.println("Remainder: " + p%q);

   }

}

A bit more detailed:

import java.util.Scanner;

public class Main {

   public static void main(String[] args) {

       Scanner scanner = new Scanner(System.in);

       System.out.println("Enter value of p :");

       int p = scanner.nextInt();

       System.out.println("Enter value of q :");

       int q = scanner.nextInt();

       System.out.println("Multiplication = " + p*q);

       System.out.println("Division = " + p/q);

       System.out.println("Remainder = " + p%q);

   }

}

Similar questions