Exemplo n.º 1
0
void testMultiplication(){
    registers[0] = 0;
    registers[1] = 4;
    registers[2] = 2;

    multiplication(registers, 0, 1, 2);

    registers[3] = 2000;
    registers[4] = 0;
    registers[5] = 1;

    multiplication(registers, 3, 4, 5);
    
    printf("Multiply Verify: ");
    if(registers[0] != 8){
        printf("Expected 8 and found: ");
        output(registers, 0);
        printf("\n");
    }
    else printf("Verified!\n");
    if(registers[3] != 0) {
        printf("Expected 0 and found: ");
        output(registers, 3);
        printf("\n");
    }
    else printf("Verified!\n");
}
/** DEBUT BIGINT puissanceDC(BIGINT, INT UNSIGNED); DEBUT **/
BIGINT puissanceDC(BIGINT nb, int unsigned exp) {
    BIGINT resultat;
    BIGINT tmp, tmp2;

    initListe(&resultat);
    initListe(&tmp);
    initListe(&tmp2);

    if(exp == 0) {
        empilerListe(&resultat, 1);
        return resultat;
    } else if(exp == 1) {
        return nb;
    }

    resultat = puissanceDC(nb, exp / 2);
    if(exp % 2 == 0) {
        tmp = multiplication(resultat, resultat);
        return tmp;
    } else {
        tmp = multiplication(resultat, resultat);
        tmp2 = multiplication(tmp, nb);
        viderListe(&tmp);
        return tmp2;
    }
}
Exemplo n.º 3
0
/* computes a conjugate gradient optimisation */
int methodedugradient(double*w,double *G,double *lambda,double *tirages,double spot, double r,int N )
{
  int i;
  double pas;
  double test;
  double t;
  double *Grad=malloc((N+1)*sizeof(double));
  double *grad=malloc((N+1)*sizeof(double));
  double *mult=malloc((N+1)*sizeof(double));
  double *add=malloc((N+1)*sizeof(double));
  double *Mult=malloc((N+1)*sizeof(double));
  double *lambda0=malloc((N+1)*sizeof(double));
  double*zero=malloc((N+1)*sizeof(double));
  double *direction=malloc((N+1)*sizeof(double));
  for(i=0;i<N;i++)
	{
	  lambda0[i]=1;
	  zero[i]=0;
	} 
	  multiplication(lambda,0,lambda0,spot,r,N);
	  gradient(w,G,Grad,tirages,lambda ,spot,r,N);
	  gradient(w,G,direction,tirages,lambda ,spot,r,N);
	  test=normeinfinie(Grad,lambda,spot,r,N);


	  while ((normeinfinie(lambda0,lambda,spot,r,N)>1E-10)&&(normeinfinie(zero,Grad,spot,r,N)/test>1E-5)){
		printf("W\n");
		t=1;
		pas=RegledeWolfe(w,lambda,direction,t,G,tirages,spot,r,N);
		
	
	for(i=0;i<N;i++){
	  lambda0[i]=lambda[i];
	
  }
	multiplication(Mult,- pas,direction,spot,r,N);
	addition(lambda,lambda0,Mult,spot,r,N);
	gradient(w,G,Grad,tirages,lambda ,spot,r,N);
	gradient(w,G,grad,tirages,lambda0 ,spot,r,N);
	multiplication(mult,produitscalaire(Grad,Grad,spot,r,N)/produitscalaire(grad,grad,spot,r,N),Grad,spot,r,N);
	addition(direction,direction,mult,spot,r,N);
	printf("%g\n",fonctionnelle(w,G,tirages, lambda, spot,r,N));
	  }
	  

	  free(Grad);
	  free(lambda0);
	  free(add);
	  free(mult);
	  free(Mult);
	  free(zero);
	  free(direction);
	  free(grad);
	
  return 0;
}
/** DEBUT BIGINT factorielle(BIGINT, INT); DEBUT **/
BIGINT factorielle(unsigned int nb) {
    BIGINT tmp, tmp2, tmp3;
    BIGINT p = chaine2liste("1");
    BIGINT r = chaine2liste("1");

    int h = 0, shift = 0, high = 1;
    unsigned int y = nb;

    initListe(&tmp);
    initListe(&tmp2);
    initListe(&tmp3);

    if (nb < 2) return chaine2liste("1");

    N = 1;
    int log2n = -1;
    /// Equivaut à log2(n) ///
    while (y) {
        y >>= 1;
        log2n++;
    }

    while (h != nb) {
        shift += h;
        h = nb >> log2n--;
        int len = high;
        high = (h - 1) | 1;
        len = (high - len) / 2;

        if (len > 0) {
            tmp = produit(len);
            tmp2 = multiplication(p, tmp);

            viderListe(&p);

            p = tmp2;

            viderListe(&tmp);

            tmp3 = multiplication(r, p);

            viderListe(&r);

            r = tmp3;
        }
    }

    viderListe(&p);

    tmp = left_shift(r, shift);

    viderListe(&r);

    return tmp;
}
Exemplo n.º 5
0
/* computes the "Regle de Wolfe" */
double  RegledeWolfe(double*w,double *x,double*d,double t,double*G,double *tirages,double spot,double r,int N)
	 
{ double m1=0.4;
  double m2=0.8;
  double td=0;
  double tg=0;
  double a=2;
  double *Grad=malloc((N+1)*sizeof(double));
  double *grad=malloc((N+1)*sizeof(double));
  double *add=malloc((N+1)*sizeof(double));
  double *mult=malloc((N+1)*sizeof(double));
  multiplication(mult,-t,d,spot,r,N);
  addition(add,x,mult,spot,r,N);
  gradient(w,G,Grad,tirages,x ,spot,r,N);
  gradient(w,G,grad,tirages,add ,spot,r,N);
	
  while((fonctiondemerite(w,x,t,d,G,tirages,spot,r,N)>fonctiondemerite(w,x,0,d,G,tirages,spot,r,N)-m1*t*produitscalaire(Grad,Grad,spot,r,N))||(produitscalaire(Grad,grad,spot,r,N)>m2*produitscalaire(Grad,Grad,spot,r,N))){printf("no\n");printf("%f %f\n",tg,td);
  
  	while (td==0){
	  printf("ok\n");
	  if (fonctiondemerite(w,x,t,d,G,tirages,spot,r,N)>fonctiondemerite(w,x,0,d,G,tirages,spot,r,N)-m1*t*produitscalaire(Grad,Grad,spot,r,N)){td=t;
	} else {
	t=a*t;
	}
	}

	t=0.5*(td+tg);
	
	
	if(fonctiondemerite(w,x,t,d,G,tirages,spot,r,N)>fonctiondemerite(w,x,0,d,G,tirages,spot,r,N)-m1*t* produitscalaire(Grad,Grad,spot,r,N)){
	td=t;

	} else {
	 
	
  	tg=t;
	
	  }
	if(fabs(td-tg)<1E-6){
	  return tg;
	} else {
	  t=0.5*(td+tg);
	}

	multiplication(mult,-t,d,spot,r,N);
	addition(add,x,mult,spot,r,N);
	gradient(w,G,grad,tirages,add ,spot,r,N);

	}		 
  free(Grad);
  free(grad);
  free(add);
  free(mult);
  
  return t;}
Exemplo n.º 6
0
int main(void) {
	Complexe a = {1,0};
	Complexe b = {1,1};
	Complexe c = {0,1};
	Complexe d = {0,2};
	Complexe e = {2, -3};
	affiche(addition(a, c));
	affiche(multiplication(c, c));
	affiche(multiplication(b, b));
	affiche(division(d, c));
	affiche(division(e, b));
}
int main(int ari,char **arc){//./a.out 5,3 4,3
	if(ari<3){
		printf("error execute like %s rowsOneMatriz,columnsOneMatriz rowsTwoMatriz,columnsTwoMatriz\n",arc[0]);
		return 1;
	}
	int upper,*dimensions=(int *)malloc(sizeof(int)*(MATRIZES*2)); //dimensions containts rows and columns of matrices one and two
	dimensions[0]=arc[1][0]-48; //set rows matriz one
	dimensions[1]=arc[1][2]-48; //set columns matriz one
	dimensions[2]=arc[2][0]-48; //set rows matriz two
	dimensions[3]=arc[2][2]-48; //set columns matriz two
	upper=getUpper(dimensions,MATRIZES*2);//get upper number of array integer dimension
	int pow3=getPow3(upper);//get pontencia of 3 same or mayor that upper
	printf("\t\t\tenter values for matriz one\n");
	int **matrizOne=getMatriz(dimensions[0],dimensions[1],pow3);
	printf("\t\t\tenter values for matriz two\n");
	int **matrizTwo=getMatriz(dimensions[2],dimensions[3],pow3);
	printf("\t\t\tmatriz one\n");
	//printMatriz(matrizOne,dimensions[0],dimensions[1]);
	printMatriz(matrizOne,pow3,pow3);
	printf("\t\t\tmatriz two\n");
	//printMatriz(matrizTwo,dimensions[2],dimensions[3]);
	printMatriz(matrizTwo,pow3,pow3);
	int **response=multiplication(matrizOne,matrizTwo,0,0,0,0,pow3);
	printf("\t\t\tresponse\n");
	printMatriz(response,dimensions[0],dimensions[3]);
	printMatriz(response,pow3,pow3);
	return 0;
}
Exemplo n.º 8
0
std::string factorial(std::string const& val, std::string const& max)
{
    if (val == max) {
        return max;
    }
    return multiplication(val, factorial(add(val, "1"), max));
}
Exemplo n.º 9
0
// Start of Main Program
int main()
{
    int X=1;
    char Calc_oprn;

    // Function call
    calculator_operations();

    while(X)
    {
        printf("\n");
        printf("%s : ", "Enter the calculator Operation you want to do:");

        Calc_oprn=getche();

        switch(Calc_oprn)
        {
            case '+': addition();
                      break;

            case '-': subtraction();
                      break;

            case '*': multiplication();
                      break;

            case '/': division();
                      break;

            case '?': modulus();
                      break;

            case '!': factorial();
                      break;

            case '^': power();
                      break;

            case 'H':
            case 'h': calculator_operations();
                      break;

            case 'Q':
            case 'q': exit(0);
                      break;
            case 'c':
            case 'C': system("cls");
                      calculator_operations();
                      break;

            default : system("cls");

    printf("\n**********You have entered unavailable option");
    printf("***********\n");
    printf("\n*****Please Enter any one of below available ");
    printf("options****\n");
                      calculator_operations();
        }
    }
}
Exemplo n.º 10
0
bool Parser::addition() {
    if (!multiplication())
        return false;
    while (*string == '+' || *string == '-') {
        string++;
        if (!multiplication())
            return false;
    }
    if (brCounter > 0) {
        if (*string != ')')
            return false;
    } else
         if (*string != 0)
         return false;	        
    return true;
}
int main(){
	
	int com;
	srand(time(NULL));
	
	do{
		com = displaymenu();
		switch(com){
			case 1:
				addition();
				break;
			case 2:
				subtraction();
				break;
			case 3:
				multiplication();
				break;
			case 4:
				division();
				break;
			case 5: printf("Have a nice day\n");
		}
	}while(com != 5);	

	//needed for all basic programs to run for the professor
	system("pause");
	
	return(0);
}
Exemplo n.º 12
0
int  main(void)
{
    char   num1[400], num[400];
	int    times = 0;

	while (scanf("%s%d", num1, &times) != EOF)
	{
		strcpy(num, num1);

		int i = 1;
		char num2[400];

		strcpy(num2, num1);

		if (times == 0)
		{
		    strcpy(num2, "1");
		}

		for (; i < times; ++i)
		{
			multiplication(num1, num2);
			strcpy(num1, num);
		}

		print_result(num2);
	}

	printf("\n");
}
Exemplo n.º 13
0
/**
 * main
 */
int main(void)
{
	int input;
    srand(time(NULL));
	
	do
	{
	    input = menu();
        
        switch (input)
        {
        case 1:
            addition();
            break;
        case 2:
            subtraction();
            break;
        case 3:
            multiplication();
            break;
        case 4:
            division();
            break;
        case 5:
            break;
        }
    }
    while(input != 5);

	printf("\nGoodbye!\n\n");
    system("pause");
    return 0;
}
Exemplo n.º 14
0
int main(void)
{
    char choice;
    printf("Please press desired key to continue ... \n\n ");

    do
    {
        printf("\nMENU\n\n"
                " + : addition\n"
                " - : substraction\n "
                " * : multiplication\n "
                " / : division\n"
                " ^ : power\n"
                " q : quit\n\n");

        printf("Command: ");
        scanf(" %c ", &choice);

        switch(choice)
        {
            case '+': summation(); break;
            case '-': substraction(); break;
            case '*': multiplication(); break;
            case '/': division(); break;
            case '^': toThePower(); break;
            case 'q': break;

            default:
            {
                fprintf(stderr, "you didn't press expected key :(\n");
            }
         }
    }
    while (choice != 'q');
}
Exemplo n.º 15
0
void CommandeManager::calculer(QString& chaine) throw(LogMessage){
    QStringList liste = chaine.split(' ',QString::SkipEmptyParts);
    for(QStringList::Iterator it = liste.begin();it!=liste.end();++it){
        QString current = *it;
        if(current.contains(QRegExp("'.*"))){
            QString expr="";
            do{
                expr+=current;
                expr+=" ";
                it++;
                current = *it;
            }
            while(!current.contains(QRegExp(".*'")));
                expr+=current;
                _pile->empilerExpression(expr);
        }
        else if(current.contains(QRegExp("^\\+$")))
            addition();
        else if(current.contains(QRegExp("^\\-$")))
            soustraction();
        else if(current.contains(QRegExp("^\\*$")))
            multiplication();
        else if(current.contains(QRegExp("^/$")))
            division();
        else{
            try{
                _pile->empilerConstante(_factory.getConstante(current));
            }
            catch(LogMessage& msg){
                throw;
            }
        }
    }
}
Exemplo n.º 16
0
void PolyaevaEV::lab8()
{
	double norm, eps = 0.0001;
	double** M = new double*[N];
	double** MT = new double*[N];
	double** AA = new double*[N];
	zeroing(x);

	for (int i = 0; i < N; i++)
	{
		AA[i] = new double[N];
		for (int j = 0; j < N; j++) AA[i][j] = 0;
	};

    do
	{
		int i_max = 0, j_max = 1;
		double max_el = abs(A[0][1]);

		for (int i = 0; i < N; i++)
			for (int j = i+1; j < N; j++)
				if (abs(A[i][j]) >= max_el) { max_el = abs(A[i][j]); i_max = i; j_max = j; };
		double phi = atan(2*max_el/(A[i_max][i_max] - A[j_max][j_max]))/2;

		for (int i = 0; i < N; i++) {
			M[i] = new double[N]; MT[i] = new double[N];
			for (int j = 0; j < N; j++) { MT[i][j] = 0; if(i == j) M[i][j] = 1; else M[i][j] = 0; };
		};
		M[i_max][i_max] = M[j_max][j_max] = cos(phi);
		M[i_max][j_max] = - sin(phi);
		M[j_max][i_max] = sin(phi);

		transposition(M, MT);
		multiplication(MT, A, AA);
		multiplication(AA, M, A);

    norm = 0;
    for (int i = 0; i < N; i++)
			  for (int j = i+1; j < N; j++) norm += pow(A[i][j],2);
    } while (sqrt(norm) > eps);
	for(int i = 0; i < N; i++) x[i] = A[i][i];

	delete[] M;
	delete[] MT;
	delete[] AA;
}
Exemplo n.º 17
0
int main() {
	int x=2, y=3;
	printf("%i\n\n", addition(x,y));
	printf("%i\n\n", subtraction(x,y));
	printf("%i\n\n", multiplication(x,y));
	printf("%f\n", division(x,y));
	return 0;
}
Exemplo n.º 18
0
int benchmark(){
	randomize();
	multiplication();
	multiplicatioOMP();
	gauss();
	gaussOMP();
 	return 0;
}
Exemplo n.º 19
0
double fonctiondemerite(double*w,double *x,double t,double *d,double *G,double *tirages,double spot,double r,int N)
{ double *add=malloc((N+1)*sizeof(double));
  double *mult=malloc((N+1)*sizeof(double));
  multiplication(mult,-t,d,spot,r,N);
  addition(add,x,mult,spot,r,N);


  return fonctionnelle(w,G,tirages,add, spot, r,N);
}
Exemplo n.º 20
0
/** DEBUT void left_shift(BIGINT, int); DEBUT **/
BIGINT left_shift(BIGINT nb, unsigned int shift) {
    BIGINT tmp;
    BIGINT tmp2;
    int j;

    initListe(&tmp);
    initListe(&tmp2);

    if (shift <= 0) return nb;

    empilerListe(&tmp, 1);
    for (j=0;j<shift;++j) {
        tmp2 = multiplication(tmp, chaine2liste("2"));
        viderListe(&tmp);
        tmp = tmp2;
    }
    return multiplication(nb, tmp);
}
Exemplo n.º 21
0
int main(void) {
	Complexe a = {1,0};
	Complexe b = {1,1};
	Complexe c = {0,1};
	Complexe d = {0,2};
	Complexe e = {2, -3};
	Complexe f = {-1, 0};
	Complexe p = {0,0};
	Complexe r = {3, -2};
	Complexe s = {-5, 1};
	affiche2(resoudre_second_degre(p, a));
	affiche2(resoudre_second_degre(r, s));
	affiche(sqrt(f));
	affiche(addition(a, c));
	affiche(multiplication(c, c));
	affiche(multiplication(b, b));
	affiche(division(d, c));
	affiche(division(e, b));
}
Exemplo n.º 22
0
int main()
{
int a = 9;
int b = 4.5;
printf("%i\n", addition(a, b));
//printf("%i\n", soustraction(a, b));
printf("%i\n", multiplication(a, b));
//printf("%f\n", division(a, b));
return 0;
}
Exemplo n.º 23
0
void factorial(int n)
{
    int i;
    strcpy(s,"1");
    for(i=2;i<=n;i++)
    {
        multiplication(s,i);
        strcpy(a[i],s);
    }
}
Exemplo n.º 24
0
// ==========================================================================================================
int main () {
	int a[max][max],b[max][max],asmatrix[max][max];
	int k,n,c,z=0;
	 	switch(
	 	GetMenu((char *)"Input length square of Matrix , Maxtrix A,B;Plus 2 Maxtrix;Subtract 2 Matrix ;Multiplile 2 Matrix;Transpose Matrix;Addition feature for matrix",6)
	 	// GetMenu((char *)"Input length square of Matrix , Maxtrix A,B;Plus 2 Maxtrix  A+B;Subtract A-B;Multiplile A*B;Transpose Matrix",5)
	 	)
	 	{	case 1:z=1;do{printf("\tSize of matrix A & B (nxn) n : ");scanf("%d",&n); if(n>max) printf("\n\tPlease Input length < %d !\n",max);}while(n>max);definematrix(a,b,n);break;
	 		case 2:if(z==0){printf("\tPlease input matrix first\n");;break;}else{plus(a,b,asmatrix,n);print2matrix(a,b,n);printf("\tThe matrix After A+B or B+A is :\n"); printmatrix(asmatrix,n);}break;
	 		case 3:if(z==0){printf("\tPlease input matrix first\n");;break;}else{for(;;){c = GetMenu((char *)"A-B;B-A;Return to main menu",3);
	 			if(c == 0 )return 0;
	 			if(c == 1 ){subtract(a,b,asmatrix,n);print2matrix(a,b,n);printf("\tThe matrix After A-B is :\n"); printmatrix(asmatrix,n);}
	 			if(c == 2 ){subtract(b,a,asmatrix,n);print2matrix(b,a,n);printf("\tThe matrix After B-A is :\n"); printmatrix(asmatrix,n);}
	 			if(c == 3 )break;}}break;
	 		case 4:if(z==0){printf("\tPlease input matrix first\n");break;}else{for(;;){ c = GetMenu((char *)"A*B;B*A;Return to main menu",3);
	 			if(c == 0)	return 0;
	 			if(c == 1)	{multiplication(a,b,asmatrix,n);print2matrix(a,b,n);printf("\tThe matrix After A*B is :\n"); printmatrix(asmatrix,n);}
	 			if(c == 2)	{multiplication(b,a,asmatrix,n);print2matrix(b,a,n);printf("\tThe matrix After B*A is :\n"); printmatrix(asmatrix,n);}
	 			if(c == 3)	break;}}break;
	 		case 5:if(z==0){printf("\tPlease input matrix first\n");break;}else{
	 					for(;;){
	 					c = GetMenu((char *)"Transpose matrix A;Transpose matrix B;Return to main menu",3);
	 					if(c == 0) return 0;
	 					if(c == 1){transpose(a,asmatrix,n);printf("\tMatrix A (left) transpose of A (right) \n");print2matrix(a,asmatrix,n);}
	 		   			if(c == 2){transpose(b,asmatrix,n);printf("\tMatrix B (left) transpose of B (right) \n");print2matrix(b,asmatrix,n);}
	 					if(c == 3) break;
	 					
	 					}}break;
	 		case 6:if(z==0){printf("\tPlease input matrix first\n");break;}else{

	 			for(;;){c = GetMenu((char *)"Determinant A;Determinant B;Invert matrix A;Invert matrix B;Rank matrix A;Rank matrix B;Return to main menu",7);
	 					if(c == 0) return 0;
	 					if(c == 1) {printf("\n\tMatrix A :\n");printmatrix(a,n);printf("\n\tDeterminant Of A is %d\n",detmatrix(a,n));}
	 					if(c == 2) {printf("\n\tMatrix B :\n");printmatrix(b,n);printf("\n\tDeterminant Of B is %d\n",detmatrix(b,n));}
	 					if(c == 3){printf("\n\tMatrix A :\n");printmatrix(a,n);compmatrixtrans(a,asmatrix,n);if(detmatrix(a,n)!= 0){printf("\n\tInvert of A is \n");printinvert(asmatrix,a,n);}}
	 					if(c == 4){printf("\n\tMatrix B :\n");printmatrix(b,n);compmatrixtrans(b,asmatrix,n);if(detmatrix(b,n)!= 0){printf("\n\tInvert of B is \n");printinvert(asmatrix,b,n);}}
	 					if(c == 5){printf("\n\tMatrix A :\n");printmatrix(a,n);printf("\n\tRank Of A is %d\n",rankm(a,n));}
	 					if(c == 6) {printf("\n\tMatrix B :\n");printmatrix(b,n);printf("\n\tRank Of B is %d\n",rankm(b,n));}
	 					if(c == 7) break;
	 		}}break;	
	 		case 0:return 0;
	 }}}
Exemplo n.º 25
0
int Matrix::multiplication(Matrix* matA, Matrix* matB, Matrix* matC)
{
	//Comprobaciones previas
	//To do
	//Multiplicacion
	Matrix Aux(matA->numFilas,matB->numColumnas);
	Aux.multiplication(matA,matB);
	multiplication(&Aux,matC);
	Aux.deletion();
	//End
	return 1;
}
int main(int argc, char *argv[])
{
    int caseNumber;
    scanf("%d",&caseNumber);
    while(caseNumber--)
    {
        input();
        multiplication();
        modulo();
        output();
    }
}
Exemplo n.º 27
0
void do_op(char C)
{
  switch(C)
  {
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9': push(C-'0'); break;
    case '+': addition(); break;
    case '-': subtraction(); break;
    case '*': multiplication(); break;
    case '/': division(); break;
    case '%': modulo(); break;
    case '^': north(); break;
    case '>': east(); break;
    case 'V':
    case 'v': south(); break;
    case '<': west(); break;
    case '?': spin(); break;
    case '!': lnot(); break;
    case '`': gt(); break;
    case '_': hif(); break;
    case '|': vif(); break;
    case '"': tsm(); break;
    case ':': dup(); break;
    case '\\': swap(); break;
    case '$': chomp(); break;
    case '#': jump(); break;
    case 'p': put(); break;
    case 'g': get(); break;
    case 'H': gate(); break;
    case '.': print_i(); break;
    case ',': print_c(); break;
    case '&': input_i(); break;
    case '~': input_c(); break;
    case '@': hacf(); break;
    case '{': left_b(); break;
    case '}': right_b(); break;
    case '[': carry_l(); break;
    case ']': carry_r(); break;
    case ';': empty(); break;
    case 'O': portal_o(); break;
    case 'B': portal_b(); break;
    default: /* DO NOTHING! */ break;
  }
}
Exemplo n.º 28
0
  main()
  
{
      int a[250]={0},b[250]={0};
      input(a,b);
      printf("\n%s+%s=",b1,b2);
    addition(a,b,0);
      printf("\n%s-%s=",b1,b2);
    subtraction(a,b,0);
      printf("\n%s*%s=",b1,b2);
    multiplication(a,b);
      while(1);
      
}
Exemplo n.º 29
0
/** DEBUT BIGINT divisionPar2(BIGINT); DEBUT **/
BIGINT divisionPar2(BIGINT nb) {
    BIGINT resultat;
    BIGINT cinq;

    initListe(&resultat);
    initListe(&cinq);

    empilerListe(&cinq, 5);

    resultat = multiplication(nb, cinq);

    defilerListe(&resultat);

    return resultat;
}
Exemplo n.º 30
0
int main(){
    int r1,c1,r2,c2,arr1[10][10],arr2[10][10],mult[10][10];
  again:
printf("enter the row and column for first matrix:\n");
scanf("%d %d", &r1,&c1);
printf("enter the row and column for second matrix:\n");
scanf("%d %d", &r2,&c2);
if(c1!=r2){
    printf("Error! rows or column of first matrix is not equal to row and column of second matrix.Enter Again!\n");
    goto again;
}
matrix_form(arr1,arr2,r1,c1,r2,c2);
multiplication(arr1,arr2,r1,c1,r2,c2,mult);
display(mult,r1,c2);
return 0;
}