Monday 28 April 2014

ShiftCypher

#include<stdio.h>
#include<conio.h>
int main()
{
    int cypher,n,i,ascii[20],num;
    char str[20];
    printf("enter shift cypher number\n");
    scanf("%d",&cypher);
    printf("enter the size of input characters :\n");
    scanf("%d",&n);
   
    printf("enter %d characters\n",n);
    for(i=0;i<n;i++)
    {
    scanf("%s",&str[i]);
    num=str[i];
    ascii[i]=num+cypher;
    }
     printf("encoded characters\n");
     for(i=0;i<n;i++)
     {
           printf("%c\n",ascii[i]);
     }   
       
       printf("decoded characters\n");
     for(i=0;i<n;i++)
     {
                     ascii[i]=ascii[i]-cypher;
           printf("%c\n",ascii[i]);
     }    
     getch();
     }


No comments:
Write comments

Featured post

List of Universities in Karnataka offering M.Sc Computer Science

The post-graduate programme in Computer Science (M.Sc Computer Science) contains two academic years duration and having a four semesters....

Popular Posts

Copyright @ 2011-2022