-->

Facebook

Jasper Roberts - Blog

Wednesday, February 24, 2016

(IS1) - Write a Program to implement - CAESER CIPHER.

#include<stdio.h>
#include<conio.h>
void main()
{
            int i;
            char om[30],em[30];
            clrscr();
            printf("Enter Original Text: ");
            gets(om);
            for(i=0;om[i]!=NULL;i++)
            {
                        if(om[i]==' ')
                        {
                                    em[i]=' ';
                        }
                        else if(om[i]>='a' && om[i]<='z')
                        {
                                    em[i]=om[i]+3;
                                    if(em[i]>'z')
                                    {
                                                em[i]=em[i]-26;
                                    }
                        }
                        else
                        {
                                    em[i]=om[i]+3;
                                    if(em[i]>'Z')
                                    {
                                                em[i]=em[i]-26;
                                    }
                        }
            }
            em[i]=NULL;
            printf("\n Your Original Text = %s ",om);
            printf("\n Enter Encrypted Text = %s ",em);
            getch();
}




OUTPUT:
program to implement caeser cipher

No comments:

Post a Comment