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
Need someone to look over my assignment for correctness and make any necessary changes.


Aim: To implement a program to convert time in 24 hour format to 12 hour format. Code:                       #include #include #include class time24 {



Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

C Programming and Data Structures 1. Define and explain flow chart with an example. 2. Write an algorithm to print all even numbers in descending order and draw the flowcha

Write a program that finds the minimum total number of shelves, including the initial one required for this loading process.

DIFFERENCE BETWEEN WHILE AND DO WHILE LOOP?

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec