Suppose I have an integer array containing numbers, and I want to store the value module in it, i.e.
int a[36]={1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9}
and convert it to a number like 987654321987654321987654321987654321 .
In C long long int only 10 ^ 18 is allowed. I want to take a module with 10 ^ 9 + 7. How can I do this?
Program:
int main() { int a[36]={1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9}; long long int temp=0; int i; for(i=0;i<36;i++) { temp=temp+a[i]*pow(10,i); } temp=temp%1000000007; printf("%lld",temp); return 0; }