Use % operator to get remainder : Remainder Operator « Operator « C# / CSharp Tutorial






using System; 
 
class Example {    
  public static void Main() {    
    int iresult, irem; 
    double dresult, drem; 
 
    iresult = 10 / 3; 
    irem = 10 % 3; 
 
    dresult = 10.0 / 3.0; 
    drem = 10.0 % 3.0;  
 
    Console.WriteLine("Result and remainder of 10 / 3: " + 
                       iresult + " " + irem); 
    Console.WriteLine("Result and remainder of 10.0 / 3.0: " + 
                       dresult + " " + drem); 
  }    
}
Result and remainder of 10 / 3: 3 1
Result and remainder of 10.0 / 3.0: 3.33333333333333 1








3.4.Remainder Operator
3.4.1.Use % operator to get remainder
3.4.2.Determine smallest single-digit factor.