0

See i am new to sololearn and it would be great help if anyone of u may step up and give link of how to write a division program

When i tried a problem so please insert a program of division https://code.sololearn.com/c5wB0VPVcZRm/?ref=app

4th Mar 2022, 8:30 AM
Arnav
Arnav - avatar
2 Respostas
+ 2
If you want to divide two int, you need to parse one variable before divide, example in java: int a=2; int b=3; double q=a/(double)b; if you parse a variable to double the dividion return a double value, so you need to store in double
4th Mar 2022, 8:33 AM
Domonkos Gyömörey
Domonkos Gyömörey - avatar
+ 1
public class Program { int n1; int n2; double q; double rem; public void input(int x,int y){ n1=x; n2=y; } public void process(){ q=n1/(double)n2; rem=n1%n2; } public void output(){ System.out.println("quotient is ="+q); System.out.println("reminderis ="+rem); } public static void main(String[] args){ Program p = new Program(); p.input(2,3); p.process(); p.output(); } }
4th Mar 2022, 8:41 AM
Domonkos Gyömörey
Domonkos Gyömörey - avatar