diff --git a/GeeksForGeeks/April/14-4-24/GFG.java b/GeeksForGeeks/April/14-4-24/GFG.java new file mode 100644 index 0000000..0f5c666 --- /dev/null +++ b/GeeksForGeeks/April/14-4-24/GFG.java @@ -0,0 +1,53 @@ +//{ Driver Code Starts +import java.util.*; + +public class GFG { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int t = sc.nextInt(); + while (t-- > 0) { + int n = sc.nextInt(); + int arr[] = new int[n]; + for (int i = 0; i < n; i++) { + arr[i] = sc.nextInt(); + } + Solution obj = new Solution(); + obj.xor1ToN(n, arr); + obj.printArr(n, arr); + obj.setToZero(n, arr); + obj.printArr(n, arr); + } + sc.close(); + } +} + +// } Driver Code Ends + + +// User function Template for Java +class Solution +{ + public void printArr(int n, int arr[]) + { + // code here + for(int a:arr) + System.out.print(a+" "); + + System.out.println(); + } + + public void setToZero(int n, int arr[]) + { + // code here + Arrays.fill(arr,0); + } + + public void xor1ToN(int n, int arr[]) + { + // code here + for(int i=0;i