-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMethods.java
37 lines (34 loc) · 922 Bytes
/
Methods.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
// How to used Method
import java.util.Scanner;
class Methods {
int n1,n2,add,sub,multi,div,rem;
public static void main(String[] args) {
Methods ref=new Methods();
ref.input();
ref.process();
ref.output();
}
void input()
{
Scanner r=new Scanner(System.in);
System.out.print(" Enter two nos ");
n1=r.nextInt();
n2=r.nextInt();
}
void process()
{
add=n1+n2;
sub=n1-n2;
multi=n1*n2;
div=n1/n2;
rem=n1%n2;
}
void output()
{
System.out.println(" Sum of two nos "+ add);
System.out.println(" subtraction of two nos "+ sub);
System.out.println(" multiplication of two nos "+ multi);
System.out.println(" division of two nos "+ div);
System.out.println(" remainder of two nos "+ rem);
}
}