# include & ltstdio.h & gt
# include & ltmath.h & gt
int candp(int a,int b,int c)
{ int r = 1;
int s;
int I = 1;
for(I = 1; I < = b; i++)r = r * a;
printf("%d\n ",r);
s = r % c;
printf("%d\n ",s);
Return to s; }
void main()
{
Intermediate p, q, e, d, m, n, t, c, r
char s;
Printf ("Please enter p, q:");
scanf("%d%d ",& ampp & amp; q);
n = p * q;
t =(p- 1)*(q- 1);
Printf(" n is% 12d\n ",n);
Printf ("Please enter e:");
scanf("%d ",& ampe);
while(e & lt; 1 | | e & gt; N) // Change this to a while loop.
{
Printf("e is an error, please re-enter: ");
scanf("%d ",& ampe);
}
d = 1;
while(((e*d)%t)! = 1)d++;
Printf ("and then calculate that d is %d\n", d);
Printf ("Please enter1\ n" for password);
printf(" plain please input 2 \ n ");
scanf("%c ",& amps);
while((s-'0 ')! = 1。 & amp(s-'0 ')! =2) // Remove the following getchar () here and add a while loop to pay attention to the characters in brackets.
{scanf("%c ",& amps); }
Switch (s-'0')
{
case 1:printf(" input the m:");
scanf("%d ",& ampm);
c=candp(m,e,n);
Printf ("Plain is %d\n", c); Break;
Case 2:printf ("input c:");
scanf("%d ",& ampc);
m=candp(c,d,n);
Printf ("Password is %8d\n", m); Break;
}
}