AIM:
To write a Java program to Encrypt the given number in IT2305 - Java Programming Laboratory.
SOURCE CODE:
To write a Java program to Encrypt the given number in IT2305 - Java Programming Laboratory.
SOURCE CODE:
import java.util.*;
class Encrypt
{
public static void main(String args[])
{
System.out.println("enter the no");
Scanner sin=new Scanner(System.in);
x=sin.nextInt();
if(x>999 &&x<=9999)
{
do
{
y=x%10;
x=x/10;
y=(y+7)%10;
z=y+z*10;
} while(x>0);
a=z%10;
z=z/10;
b=z%10;
z=z/10;
c=z%10;
z=z/10;
d=z%10;
z=(c*1000+d*100+a*10+b);
System.out.println(z);
}
else
System.out.println("enter the valid no");
}
}
EmoticonEmoticon