#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

void Addition ( double [] , int );
void Subtraction ( double [] , int );
void Multiplication ( double [] , int );
void Division ( double [] , int );
void SqareRoot ( double );
void Factorial ( unsigned long );
void Modulus  ( double , double  );
void Minimum ( double [] , int );
void Maxmum ( double [] , int );


int main ()
{
	int choice , x;
	int ArrySize=0;
	double arry;
	double number1 , number2;
	unsigned long FactNum;



	do 
	{
		do
		{

	cout<<"\n\n";
	cout<<"       **************** Welcom To Our Calculator **************** "<<endl;
	cout << "\n\n\n                M E N U \n\n";
    cout <<" Addition operation ------------> 1\n";                         
    cout <<" Subtraction operation ---------> 2\n";
    cout <<" Multiplication operation ------> 3\n";
    cout <<" Division operation ------------> 4\n";
    cout <<" Sqare root operation ----------> 5\n";
	cout <<" Factorial operation -----------> 6\n";
	cout <<" Modulus operation -------------> 7\n";
    cout <<" Maximum operation -------------> 8\n";
	cout <<" Minimum operation -------------> 9\n";
	cout <<" Exit the calculator -----------> 10\n";
    cout <<"\n Enter your choice please : ";
    cin >>choice;

		} while (choice<1 || choice > 5);


		 switch 
			 (choice)

                {
					case 1 :
						cout<<"\n\n Enter the numbers:";
						
						for ( int i=0; i<x ; i++)
						ArrySize += 1;

						cin>>arry;
						Addition (arry ,ArrySize);

						break;



					case 2 :
						cout<<"\n\n Enter the numbers:";
						
						for ( int i=0; i<x ; i++)
						ArrySize += 1;

						cin>>arry;
						Subtraction (arry ,ArrySize);

						break;



					case 3 :
						cout<<"\n\n Enter the numbers:";

						for ( int i=0; i<x ; i++)
						ArrySize += 1;

						cin>>arry;
						Multiplication (arry ,ArrySize);
						
						break;



					case 4 :
						cout<<"\n\n Enter the numbers:";
						
						for ( int i=0; i<x ; i++)
						ArrySize += 1;

						cin>>arry;
						Division (arry ,ArrySize);

						break;



					case 5 :
						cout<<"\n\n Enter a number:";
						cin>>number1;
						SqareRoot ( number1 );

						break;




					case 6 :
						cout<<"\n\n Enter a number:";
						cin>>FactNum;
						Factorial ( FactNum );

						break;



					case 7 :
						cout<<"\n\n Enter two numbers:";
						cin>>number1>>number2;
						Modulus ( number1 , number2);

						break;



					case 8 :
						cout<<"\n\n Enter the numbers:";

						for ( int i=0; i<x ; i++)
						ArrySize += 1;

						cin>>arry;
						Maximaum (arry ,ArrySize);

						break;



					case 9 :
						cout<<"\n\n Enter the numbers:";						
						for ( int i=0; i<x; i++)
						ArrySize += 1;
						Minimum (arry ,ArrySize);

						break;



					case 10 :
						cout <<"\n\n End of job thank you....";
						break;

		 }

	} while (choice !=5); 



cin.get();
return 0;
}


void Addition ( double arry1[] , int ArrySize1 )
{
	double result=0;
	for( int j=0; j<ArrySize1; j++)
		result+= arry1[j];
	cout<<"The result is :"<<" "<<result;
}

void Subtraction ( double arry1[] , int ArrySize1 )
{
	double result=0;
	for( int j=0; j<ArrySize1; j++)
		result-= arry1[j];
	cout<<"The result is :"<<" "<<result;
}

void Multiplication  ( double arry1[] , int ArrySize1 )
{
	double result=1;
	for( int j=0; j<ArrySize1; j++)
		result*= arry1[j];
	cout<<"The result is :"<<" "<<result;
}

void Division  ( double arry1[] , int ArrySize1 )
{
	double result=1;
	for( int j=0; j<ArrySize1; j++)
		result/= arry1[j];
	cout<<"The result is :"<<" "<<result;
}


void SqareRoot ( double num1 )
{
	cout<<"The result is :"<<" "<<sqrt(num1);
}


void Modulus ( double numb1 , double numb12 )
{
	double result=0;
		result= numb1 % numb2 ;
	cout<<"The result is :"<<" "<<result;
}

void Factorial( unsigned long num )
 {                                                                             
      if ( num <= 1 )                           
		  return 1;                                
                           
	  else                                        
		  return num * factorial( num - 1 ); 
}

void Maximum ( double arry1[] , int ArrySize1 )
{
	double Max=arry1[0];
	for( int j=0; j<ArrySize1; j++)
	{
		if ( arry1[j] > Max )
			Max=arry1[j];
	}

	cout<<"The result is :"<<" "<<Max;
}
void Multiplication ( double [] , int );