Java Program to Encrypt the given Number | IT2305 - Java Programming Lab


AIM:
 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[])
 {
  int x,y,a,b,c,d,z=0;
  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");
}
}
Previous
Next Post »

Still not found what you are looking for? Try again here.