Hello,

I have calculated using this table:-

Now I want to calculate the PERIOD.In the above output we find the pattern "1,7,4,13" to repeat itself.Hence it is the PERIOD.Can you please write the code for how to match this pattern...it should be generic so that it will respont for any given numbers.....can u please help me out......

I have calculated using this table:-

**Input Register**

**7 Mod 15**

**Output Register**

|0>

7 Mod 15

1

|1>

7 Mod 15

7

|2>

7 Mod 15

4

|3>

7 Mod 15

13

|4>

7 Mod 15

1

|5>

7 Mod 15

7

|6>

7 Mod 15

4

|7>

7 Mod 15

13

Code:

#include<stdio.h> #include<math.h> mod_func(long int n1,long int n2) { long int i,w,m; for(i=0;i<15;i++) { w=pow(n1,i); m=w%n2; printf("m=%ld\n",m); } } main() { long int n1,n2,limit; clrscr(); printf("enter n1:"); scanf("%ld",&n1); printf("enter n2:"); scanf("%ld",&n2); mod_func(n1,n2); getch(); }