Rail Fence IN c


* Program to implement Rail Fence Cipher */

#include<stdio.h>
#include<string.h>


int main()
{
char text[50],t[50],c[50];
int k=0,l,i,j,count=0;
printf("Enter Plain Text:\n");
gets(text);
for(i=0,j=0;text[i]!='\0';i++)
if(text[i]!=' '){
t[j]=text[i];j++;
}
t[j]='\0';
l=strlen(t);
i=count;j=0;
while(count<=3)
{
if(i>=l)
i=++count;
c[j]=t[i];
/*if(k==4)
{
k=0;yy
c[j]=' ';
j++;

}*/
//printf("%c",c[i]);
i=i+4;
j++;k++;
}
c[l]='\0';
printf("\nCipher text %s %d",c,l);
printf("\nLenght is %d %d ",strlen(c),strlen(t));
puts(c);
return 0;
}

/* Output */

Enter your email address:
Delivered by FeedBurner

No comments: