10-08-2011, 11:43 AM
Code:
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
double p,q,n,m,e,k,z,d1,c1,c2,y;
double d,l,x,c,d2;
clrscr();
printf("The P,Q Primary values:");
scanf("%lf%lf",&p,&q);
n=p*q;
printf("N value is %lf",n);
k=(p-1)*(q-1);
printf("\n K(n) value is:%lf",k);
printf("\n Enter the Integer which is relative to the prime to the K(n)");
scanf("%lf",&e);
d2=pow(e,-1);
d=fmod(d2,k);
printf("%lf",&d);
printf("\n Enter the plain text number ");
scanf("%lf",&m);
d1=pow(m,e);
c=fmod(d1,n);
printf("\n Encription of the plain text:%lf\n",c);
c2=pow(d1,d);
x=fmod(c2,n);
printf("\n Description of the plain text: %lf\n",x);
getch();
}