-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exo arithmetic 2.15 .java
37 lines (36 loc) · 1.13 KB
/
Exo arithmetic 2.15 .java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package exos;
import java.util.Scanner;
/**
*
* @author percy-ashu
*/
public class Exos {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int numb1,numb2;
int sum;float quot=1;int dif=0; int prod;
System.out.print("Enter first integer: "); // prompt
numb1 = in.nextInt(); // read first number from user
System.out.print("Enter second integer: "); // prompt
numb2 = in.nextInt(); // read second number from user
sum = numb1 + numb2;
prod = numb1 * numb2 ;
if(numb1<numb2){
quot = numb2 / numb1;
dif =numb2 - numb1;}
if(numb1>numb2){
quot = numb1 / numb2;
dif = numb1 - numb2;
// TODO code application logic here
}
System.out.printf("sum = %d%n dif = %d%n prod =%d%n quot =%.2f%n ",sum,dif,prod,quot);
}
}