Java examples for Language Basics:Operator
Use integer division to divide a by b, then the result times b plus the remainder equals a.
public class Main { public static void main(String[] args) { int a = 29; // any value will do int b = 3; // any value will do int c = a / b; int d = a % b; int e = (c * b) + d; // e will always equal a System.out.println(e);//from w ww .jav a2 s. co m } }