Program to convert fraction to decimal, C/C++ Programming

Program to convert fraction to decimal:

int main()

{

                float num, denom;     // numerator and denominator of fraction

                float value;          // value of fraction as decimal

 

                cout << "Convert a fraction to a decimal\n";

                cout << "Numerator: ";

                cin >> num;

                cout << "Denominator: ";

                cin >> denom;

 

                value = num / denom;  // convert fraction to decimal

 

                cout << '\n' << num << '/' << denom << '=' << value;

 

                return 0;

}

Posted Date: 10/18/2012 7:56:21 AM | Location : United States







Related Discussions:- Program to convert fraction to decimal, Assignment Help, Ask Question on Program to convert fraction to decimal, Get Answer, Expert's Help, Program to convert fraction to decimal Discussions

Write discussion on Program to convert fraction to decimal
Your posts are moderated
Related Questions
how we use the cin command and why we use this command????

c++ program to to implement multiple stacks using single array

calculate the total resisitance of a series circuit?

in this problem you are given a board in which some of the elements are placed as shown in below diagram.each element represent a color.fill the other element in the board,such tha

WAP TO SWAP THE THREE DIGIT NUMBER void main () { int b,r,n,r1,r2; clrscr (); printf ("Enter the Value: "); scanf ("%d",&n); r=n%10; n=n/10; r1=n%10;

Explain the Symbolic Constants in c language? Symbolic constants are the constants of any type that declared by using the #define compiler directive and it is a preprocessor di

Discuss the saleint featuresand application of c

Illustration of Grid function: For illustration, the script below creates two individual figure windows. At First, it clears the figure window. Then, it generates an x vector

Returning References from Functions Just as in passing the parameters by reference, returning a reference also doesn't return back a copy of the variable , instead an alias is

Write two different arrays. Store the names in it and then compare if both the names entered by the user are the same.