QR.java
Aim:
To find Quotient and Remainder
Source code:
import java.lang.*;
import java.util.*;
class QR
{
public static void main(String args[])
{
double a,b,q;
int r;
Scanner input=new Scanner(System.in);
System.out.println("Enter values for a,b");
a=input.nextDouble();
b=input.nextDouble();
q=a/b;
r=(int)a%(int)b;
System.out.println("Quotient="+q);
System.out.println("Remainder="+r);
}
}
Output:
Enter values for a,b
7
3
Quotient=2.3333333333333335
Remainder=1
No comments:
Post a Comment