HI
I want to write a class that it gets two decimal numbers and add them without using decimal expression like double and float .

for example
12/05 + 1/98 =14.3

How can I do so ?
thanks

I suppose you could multiply everything by 100 do the integer division, then divide the final result by 100. But 14.3 can not be stored as an integer, so I assume you will just want to print it, such as printf("%.1f\n", (float)1430/100);

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.