Programs in JAVA to get the remainder and quotient of given two numbers without using % and / operators?

Answer Posted / swap1710

import java.util.*;
class Rem
{
public static void main(String args[])
{
double f,qu,remi;
int i,qu1;
Scanner s= new Scanner(System.in);
System.out.println("Enter No..");
f=s.nextFloat();
qu=f*0.1;
qu1=(int)qu;
remi=(qu-qu1)*10;
System.out.println("quotient=" +qu1);
System.out.println("Reminder="+(int)remi);
System.out.println(qu1+"*10" + "+" +(int)remi+"="+(int)f);
}
}

/*
Output:


D:Javap>java Rem
Enter No..
45
quotient=4
Reminder=5
4*10+5=45
*/

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 1 number. Find the missing number

729


details description on this mantis? who is founder of this mantis?

1681


What's the difference b/w Table & Templete in Smartform?

1643


Busy waiting is a method whereas a taskwaits for a given event by continiously checking for an event to occur. What is the main problem with this approach

1410


When we use Windows authentication mode

1580






hi this is uday i want prepare for nic exam if any one have previous question papers please send me or atlest guide me how to prepare my ID is udaykiran4u@in.com

1476


Write a program to swap the content of two variables without using a third variable.

578


Which CRM is better to opt, Sebiel CRM or Salesforce CRM or sap CRM? which institute is best one in hyderabad

1847


what are the missinschema properties and should we pass primary key in select command

1419


Difference between delegates and Events?

1714


What is autocall macro and how to create autocall macro? what is the use of it?

1497


How to print No.of.rows affected after updation using ADO.Net

2478


I am looking for selenium RC online Training in chennai. can any one tell me the best institute

1526


Where do we need Operator overloading?

655


what are other resources are needed for this mantis?

1520