Lab 01 Muskan
Lab 01 Muskan
1. Write a function in Java (or any language) to read a list of 10 integer numbers and arrange them
in such a manner that all the even numbers start from the left and all the odd numbers start
from the right.
Input: 1 2 3 5 7 2 2 7 8 9
Output: 1 3 5 7 7 9 2 2 2 8
package lab1.Task;
import java.io.*;
// if array of element
// is odd then swap
if (arr[i] % 2 == 0) {
// increment j by one
j++;
// Driver code
public static void main(String args[])
{
int arr[] = { 14, 16, 17, 45, 4, 10, 11, 45 };
int n = arr.length;
rearrangeEvenAndOdd(arr, n);
TASK :02
2. Suppose that we have the following message stored in string named message as
below: String message = “Hello world”;
The message above was encrypted in such a way that every character was encrypted
after adding a unique key to it. The message after encryption become:
Output: Igopt&^w{vo
Write a function that will help you in predicting the unique key used for each
character of our input message.
package lab1.Task;
noDup(twoDArray, oneDArray);