Hi i'm having some trouble getting my head around this assignment...
which is :
Design, write and test a program to print a table of factorials. The program should read in two values: a maximum factorial value and a minimum factorial value.
It must then print a table, as illustrated below, with one column for the factorial number, one column for the factorial expression and a third column showing the result. The program must produce this table from maximum factorial value to the minimum factorial value; e.g. if the maximum factorial value is 5 and the minimum factorial value is 3 the program produces a table like the following:

Factorial value	Factorial Expression 	Result
-----------------------------------------------------------------------------------
5!		                                 5*4*3*2*1		120
4!		                                  4*3*2*1		24
3! 		                                     3*2*1		         6

------------------------------------------------------------------------------------

The program must repeatedly ask the user to input data and print a table of factorials, as illustrated above, until the user decides to exit the program.


so far i have been succesfull in creating the table reading in a maximum and min factorial and creating a list downwards to the left

what im finding hard is placing the 5*4*3 etc into the middle column

here is my code so far

#include <stdio.h>
#include<conio.h>

void main()
{
	// defining and initialising variables
    int max , factorial;
	int min=0;
    
    //enters a maximum factorial
	printf("Please enter a Maximum Factorial:");
	scanf("%d", &max);
    fflush(stdin);
    //enters a minimum factorial
	printf("\nPlease enter a Minimum factorial:");
	scanf("%d", &min);	
    fflush(stdin);
    //handles an input error
    if (max>min)
	printf("----------------------------------------------------------------------");
      else 
         printf("\nyou have entered an invalid number\n");
  
	printf("\nFactorial Value        Factorial expression        Factorial Result");
    printf("\n----------------------------------------------------------------------");
    //creating a list from max to min factorials
	factorial=max;
	while ( factorial>=min){
	printf("\n%d!" ,max);
	max=max-1;
	factorial=factorial-1;
	}

getch();
}

if anyone could help it would be hugely appreciated

Disregarding the header and the bottom of the table and just
considering the inside of the table you can simply just do this :

for(int i = Max; i >= Min; --i){
		//print i
                //print '!'
		//print  \t
		//prints (i)*(i-1)*(i-2)*...(1)
		//print factorial of i
		//print new line
	}
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.