-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathADD.java
More file actions
50 lines (45 loc) · 1.21 KB
/
Copy pathADD.java
File metadata and controls
50 lines (45 loc) · 1.21 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
package add;
import java.util.Scanner;
public class ADD {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("egfjgjgv");
Scanner sc=new Scanner(System.in);
int i,j,k;
int a[]=new int[40];
System.out.println("enter the number:\n");
for(i=0;i<6;i++)
{
//a[i]=sc.nextInt();
//System.out.println("enter the number:\n");
a[i]=sc.nextInt();
System.out.println(a[i]);
}
int n;
do {
System.out.println("enter the number 1 for add:\n");
System.out.println("enter the number 2 for addition:\n");
System.out.println("enter the number 0 for exit:\n");
System.out.println("enter the number of n:\n");
n=sc.nextInt();
if(n==1)
{
i=sc.nextInt();
j=sc.nextInt();
k=i+j;
System.out.println(k);
}
if(n==2)
{
i=sc.nextInt();
j=sc.nextInt();
k=i*j;
System.out.println(k);
}
if(n==0)
{
System.out.println("exit");
}
}while(n>=0);
}
}