You are on page 1of 1

#include<stdio.

h>
#include<math.h>
int main()
{
int n,g,x,y,k1,k2,A,B;
printf("Enter the values of n and g\n");
scanf("%d %d",&n,&g);
printf("\nEnter thr values of x and y\n");
scanf("%d %d",&x,&y);
A=(int)(pow(g,x))%n;
B=(int)(pow(g,y))%n;
printf("\nValue of A = %d\n",A);
printf("\nvalue of B = %d\n",B);
k1=(int)(pow(B,x))%n;
k2=(int)(pow(A,y))%n;
printf("Value of KA = %ld\n",k1);
printf("value of KB = %ld\n",k2);
return 0;
}

You might also like