Can we print rational numbers instead of decimal ratios?
for example,
a=3;
b=4;
if we print a/b, we have to get 3/4 instead of 0.75
harikrishna439
0
Light Poster
Recommended Answers
Jump to Postyes, that's the way
a=3; b=4; printf("%d/%d",a,b);
Jump to PostDo you want to use the %x or %X (hexadecimal) format in printf()?
printf("\n%x/%x \n",numerator, denominator); //or X for upper case letters
All 5 Replies
Perry31
-6
Light Poster
vinitmittal2008
37
Junior Poster
sharathg.satya
-10
Posting Whiz in Training
Adak
419
Nearly a Posting Virtuoso
sharathg.satya
-10
Posting Whiz in Training
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.