Solved

# money(currency) calculations (newbie question)

Posted on 2004-09-10

I'm trying to write a program that uses money through out. The problem i'm having is with the control strings ( %d, %f, %g etc)

Take for instance

========================================================

// Start Program

#include <stdio.h>

#include <conio.h>

main ()

{

float m,n,o;

o=m+n;

printf("Please enter the value of m :");

scanf("%f",&m);

printf("The value of m is equal to %g\n",m);

printf("Please enter the value of n :");

scanf("%f",&n);

printf("The value of n is equal to %g\n",n);

printf("The value of n is equal to %.2f\n",o);

getch();

}

//End Program

======================================================================

Output

===============

Please enter the value of m :15.65

The value of m is equal to 15.65

Please enter the value of n :20

The value of n is equal to 20

The value of o is equal to 7865950856751840200000000000000000.00

=================

The sum is so ridiculous and i am wondering what i have to do to fix it

Adecold