-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathu2.java
More file actions
24 lines (24 loc) · 702 Bytes
/
Copy pathu2.java
File metadata and controls
24 lines (24 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.util.Scanner;
public class u2 {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int n;
System.out.println("enter no. of inputs : ");
n=s.nextInt();
int ar[]=new int[n];
for(int i=0;i<n;i++){
System.out.println("enter the element : "+i);
ar[i]=s.nextInt();
}
int k;
System.out.println("enter the element : ");
k=s.nextInt();
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(ar[i]+ar[j]==k){
System.out.println(ar[i]+","+ar[j]);
}
}
}
}
}