Implements caesar cipher algorithms

The caesar are known as the shift cipher which is one of the simplest techniques of encryption.It is part of substitute ciphertext in which any word replace by increase or decrease any number to word.For examples if plain text word is A then we increase it 3 word as get D as encrypted word.

The pattern of 3 word encryption and decryption are given below:

Plain text:ABCDEFGHIJKLMNOPQRSTUVWXYZ
ENCRYPTED TEXT :DEFGHIJKLMNOPQRSTUVWXYZABC

Here we say that A is repaced by D,B is replaced by E.Here we need to repace Z by A,That is get by increase 3 but the value is greater than 26,need to decrease by 26.so,get C.


The algorithm program is:
#include<stdio.h>
#include<conio.h>
#include<string.h>

void enc(char p[]);
void dec(char c[]);
int k;
void main()
{
                        char p[20];
                        clrscr();
                        printf("enter the plaintext:");
                        scanf("%s",&p);
                        printf("enter the key:");
                        scanf("%d",&k);
                        enc(p);
            getch();
}
void enc(char p[])
{
                        int i;
                        char c[50];
                        for(i=0;i<strlen(p);i++)
                        {
                                    c[i]=p[i]+k;
                                    if((c[i]>90 && c[i]<94)||(c[i]>122 && c[i]<126))
                                    c[i]=p[i]+k-26;
                        }
                                    c[i]=NULL;
                                    printf("encrypted message: %s",c);
                                    dec(c);
}
void dec(char c[])
{
                        int i;
                        char p[100];
                        for(i=0;i<strlen(c);i++)
                        {
                                    p[i]=c[i]-k;
                                    if((c[i]>64 && c[i]<69)||(c[i]>96 && c[i]<100))
                                    p[i]=c[i]-k+26;
                        }
                                    p[i]=NULL;
                                    printf("\n decrypted message:%s",p);
}