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
how CLR identify vb file?
how to study PHP my own? i reffered many sites.. but as being a fresher i couldnt follow those... which site will be the best one?
Which method protects back button to retrieve old value from previous page in Struts.
What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
any drawback are there in mantis?
Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 2 numbers. Find the missing numbers.
Given an array of size n+1 which contains all the numbers from 1 to n.Find the number which is repeated in O(n) time.How do you proceed with the same with floating numbers from 0 to 1 instead of 1 to n?
what is the difference between an OS(operating system) and Framework?
how to hide prompts
Given an array of size n. It contains numbers in the range 1 to n. Find the numbers which aren?t present.
what is apt_dump_score in datastage where it is useful
What binary value will be internally stored for NULL for the type S9(1) COMP 3 in mainframe
Define distributed queries. can you explain me as soon as possible
What is web.configuration? how is it work? & wht is use this?
Please forward important interview and basic questions in VB6 on my email id: usneha_16@yahoo.co.in