Computer Science, asked by sravanipotharaveni12, 3 months ago

print the integer representation of the encrypted Numbers?

Answers

Answered by Barani22
3

Explanation:

Program:

n=int(input())

string = input()

encryptedstring=""

for i in string:

encryptedstring = encryptdstring + chrr( ord(i)+ n)

#erase one r in chrr

print(encryptedstring)

Input:

3

as3gAsd

Output:

dv6jDvg

Answered by Jasleen0599
0

JAVA PROGRAM

package arrayproblems;

import java.util.ArrayList;

class Problem21 {

   public static void main(String[] args) {

       int N=25143;

       int key=3;

       String res="";

       ArrayList array1=new ArrayList();  

       while(N!=0) {

           array1.add(N%10);

           N=N/10;

       }

       int[] array2=new int[array1.size()];

       int k=0;

       for(int i=array1.size()-1;i>=0;i--) {

           array2[k]=(int) array1.get(i);

           k=k+1;

       }

       

       for(int j=0;j<key-1;j++) {

           

           int temp=array2[array2.length-1];

           

           for(int i=array2.length-1;i>=1;i--) {

               

               array2[i]=array2[i-1];

           }

           array2[0]=temp;

       }

       for(int i:array2) {

           System.out.print(i+res);

       }

       

   }

}

Method for solving

  1. Take the integer N, the Key value, and all user inputs.
  2. Initial arraylist to integer conversion
  3. then arraylist -> array conversion.
  4. Then, to obtain the new array, "Rotate array" by "key-1" time towards the right side.
  5. Return the response as 43251 after converting the array to the string type.

#SPJ2

Similar questions