Caesar_Cipher (Encryption)

Posted: July 27, 2012 in Java Programs
Tags: , ,

import java.util.*;
import java.io.*;
class caesar
{
public static void main(String k[])
{
int c;
System.out.println(“ENTER PLAIN TXT :”);
Scanner sc=new Scanner(System.in);
String s=sc.nextLine();
s=s.toLowerCase();
for(int i=0;i<s.length();i++)
{
c=s.charAt(i);
c=c+3;
if(c>122)
{
c=c%122;
c=c+96;
}

System.out.println((char)c);
}

}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s