Hello all, I am hopeing someone can help me out on this, Yes this is homework and i have been trying to figure it out for the past couple of days and it is due tonihgt, the teacher wont really help any of us.We need to write a program in C++ that Computes two rational fractions. It needs to read the inputs of the two fractions (N and D) that are inputed and then print them in 2D form:

## 23

66

Then it must mutlply the two fractions togeher and print the anwser in traditional two-dimenstional form. The Part that im getting confussed on is we are soposed to use a counter to count the amount of numbers in the fraction so i can calculate the right amount of ---- between the numbers.

Here is the program I started to write for this. Im not sure if im gogin down the right road or not, Please Help

```
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main ()
{
/* Declarations & Initialization
of Variables, Symbolic Constants */
int a,b,ab;
double AB;
*Part A, User Input 1*/
printf("This Program Computes Rational Fractions\n\n");
printf("Please Enter Your Value For The First Numerator And Denominator: ");
scanf("%i %i",&a,&b);
printf("%i %i",a/b);
/* Exit Program */
return EXIT_SUCCESS;
}
```

Here is what the TA gave us to help with the counter , I tried to run this and it wont run.

```
#define max(a,b) (((a) > (b)) ? (a) : (b))
*/
#include <stdio.h>
#include <stdlib.h>
int count_digits(int n);
int main()
{
int numDigits;
numDigits=count_digits(6000);
printf(" number of digits =%d",numDigits);
return 0;
}
int count_digits(int n)
{
int digits=1;
while(n/10 >0)
{
n=n/10;
digits=digits +1;
}
return digits;
}
```