How to compute mod of a big number ? | C # program to compute mod of a big number represented as string ; Function to compute num ( mod a ) ; Initialize result ; One by one process all digits of ' num ' ; Driver code
using System ; public class GFG { static int mod ( String num , int a ) { int res = 0 ; for ( int i = 0 ; i < num . Length ; i ++ ) res = ( res * 10 + ( int ) num [ i ] - '0' ) % a ; return res ; } public static void Main ( ) { String num = "12316767678678" ; Console . WriteLine ( mod ( num , 10 ) ) ; } }