Write a program to determine the quotient and remainder for integer 17 by 3 ( java program )
Answers
Answered by
2
public class Main {
public static void main(String [] args) {
int quotient = 17 / 3;
int remainder = 17 % 3;
System.out.println("The quotient is " + quotient + " and remainder is " + remainder);
}
}
- We have declared the class name as "Main".
- Then there comes the main method which is required in almost every valid java program.
- We declared two variables - quotient and remainder containing the value of each of the calculation respectively.
- The we used the println method for printing the text.
- Always use '/' for getting the quotient, whereas '%' for getting the remainder.
Hope it helps...
Similar questions