Ceaser cipher program in c

//Ceaser cipher program in c

#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<ctype.h>
void main()
{
            int i,k,b,p,d,dk;
            char in[10],encrpt[10];
            clrscr();
            printf("\nenter the plain text:");
            gets(in);
            printf("\nenter the key for encrption:");
            scanf("%d",&k);
            printf("\nencrypted text:");
            for(i=0;i<(strlen(in));i++)
            {
                        if(isupper(in[i]))
                        {
                                    p=in[i];
                                    p=p+k;
                                    if(p<65)
                                    {
                                                b=65-p;
                                                p=91-b;
                                    }
                                    else if(p>90)
                                    {
                                                b=p-90;
                                                p=b+64;
                                    }

                        }
                        if(islower(in[i]))
                        {
                                    p=in[i];
                                    p=p+k;
                                    if(p<97)
                                    {
                                                b=97-p;
                                                p=123-b;
                                    }
                                    else if(p>122)
                                    {
                                                b=p-122;
                                                p=b+96;
                                    }
                        }
                        encrpt[i]=p;
                        printf("%c",p);
            }
            printf("\nenter the key for decrption: ");
            scanf("%d",&dk);
            if(k==dk)
            {
                        printf("\nkey is correct");
                        printf("\ndecrepted text:");
                        for(i=0;i<(strlen(in));i++)
                        {
                                    if(isupper(encrpt[i]))
                                    {
                                                d=encrpt[i];
                                                d=d-k;
                                                if(d<65)
                                                {
                                                            b=65-d;
                                                            d=91-b;
                                                }
                                                else if(d>90)
                                                {
                                                            b=d-90;
                                                            d=b+64;
                                                }

                        }
                        if(islower(encrpt[i]))
                        {
                                    d=encrpt[i];
                                    d=d-k;
                                    if(d<97)
                                    {
                                                b=97-d;
                                                d=123-b;
                                    }
                                    else if(d>122)
                                    {
                                                b=d-122;
                                                d=b+96;
                                    }
                        }
                        printf("%c",d);
            }
            }
            else
            {
                        printf("\nenter valid key");
            }
            getch();
}