I'm new at Java, and I'm probably just an idiot, but I need to know how to show an answer as both a fraction and a decimal. Can anyone tell me how?
tripnip
0
Newbie Poster
Recommended Answers
Jump to PostHere is a way that you can do it:
public class Decifrac{ public static void main(String[] args){ int a = 9; int b = 8; double c = ((a * 1.0)/b) ; System.out.println("You could show it as a fraction like this: " + a + "/" + …
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.