Program No: 1: Aim: Source Code
Program No: 1: Aim: Source Code
PROGRAM NO: 1
SOURCE CODE :
#include<stdio.h>
# include<conio.h>
#include<string.h>
void main()
{
//to hold plain text fed in by the user
char PT[50];
char ch;
int len,i;
clrscr();
len=strlen(PT);
ch=PT[i]+3;
if(ch>'z')
CT[i]=ch-26;
[Type text]
else
CT[i]=ch;
}
OUTPUT :
PROGRAM NO: 2
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
//to hold plain text fed in by the user
char PT[50];
clrscr();
len=strlen(PT);
for(i=0;i<len;i++)
{
}
[Type text]
printf("%s",CT1);
printf("%s",CT2);
getch( );
OUTPUT :
PROGRAM NO: 3
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
//to hold plain text fed in by the user
char PT[3];
//to hold the converted character array into corresponding integer matrix
int inp[3][1];
clrscr();
//to read the input plain text
printf("Enter the plain text(of three alphabets):");
gets(PT);
inp[i][0]=PT[i]-65;
//to convert the integer matrix into corresponding character - CIPHER TEXT
for(i=0;i<3;i++)
{
CT[i]=(res[i][0]%26)+65;
printf("%c",CT[i]);
}
getch();
}
OUTPUT :
PROGRAM NO: 4
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
# include<string.h>
void main()
{
clrscr();
len=strlen(PT);
if(i%4==1)
{
CT[j]=PT[i];
j++;
}
}
for(i=0;i<len;i++)
{
//if index is 3
if(i%4==3)
{
CT[j]=PT[i];
j++;
}
}
for(i=0;i<len;i++)
{
//if index is 2
if(i%4==2)
{
CT[j]=PT[i];
j++;
}
}
for(i=0;i<len;i++)
{
//if index is 4
if(i%4==0)
{
CT[j]=PT[i];
j++;
}
}
getch();
}
[Type text]
OUTPUT :