Enviado em 15/12/2005 - 18:18h
Olá Pessoal,
Postei essa pergunta faz alguns dias, não obtive resposta, pois acho que postei na parte errada do site, vamos lá...
Queria saber se alguem por aqui gosta de implementar esse algoritmos matemáticos? e se já implementou sarrus de uma forma diferênte da que adotei? segue a baixo o código:
#include <stdio.h>
int h,i,j;
int a[3][3],r[3][3];
int d;
int xy(int x, int y)
{
printf("{TEXTO}33[%d;%dH",x,y);
}
void lerMATsarr(void)
{
int x,y;
y=0;
x=3;
for(h=1;h<=3;h++)
{
x++;
y=0;
y++;
for(j=1;j<=3;j++)
{
y+=6;
xy(x,y);
scanf("%d",&a[h][j]);
}
}
}
int main(void)
{
printf("{TEXTO}33[2J");
lerMATsarr();
h=1;
d=((a[h][h]
*a[h+1][h+1]
*a[h+2][h+2]) //OK
+(a[h][h+1]
*a[h+1][h+2]
*a[h+2][h]) //ok
+(a[h][h+2]
*a[h+1][h]
*a[h+2][h+1]) //ok
-((a[h][h+1]
*a[h+1][h]
*a[h+2][h+2]) //ok
+(a[h][h]
*a[h+1][h+2]
*a[h+2][h+1]) //ok
+(a[h][h+2]
*a[h+1][h+1]
*a[h+2][h])));
printf("\n det(A) = %d\n",d);
return 0;
}
Vlw?
Postei essa pergunta faz alguns dias, não obtive resposta, pois acho que postei na parte errada do site, vamos lá...
Queria saber se alguem por aqui gosta de implementar esse algoritmos matemáticos? e se já implementou sarrus de uma forma diferênte da que adotei? segue a baixo o código:
#include <stdio.h>
int h,i,j;
int a[3][3],r[3][3];
int d;
int xy(int x, int y)
{
printf("{TEXTO}33[%d;%dH",x,y);
}
void lerMATsarr(void)
{
int x,y;
y=0;
x=3;
for(h=1;h<=3;h++)
{
x++;
y=0;
y++;
for(j=1;j<=3;j++)
{
y+=6;
xy(x,y);
scanf("%d",&a[h][j]);
}
}
}
int main(void)
{
printf("{TEXTO}33[2J");
lerMATsarr();
h=1;
d=((a[h][h]
*a[h+1][h+1]
*a[h+2][h+2]) //OK
+(a[h][h+1]
*a[h+1][h+2]
*a[h+2][h]) //ok
+(a[h][h+2]
*a[h+1][h]
*a[h+2][h+1]) //ok
-((a[h][h+1]
*a[h+1][h]
*a[h+2][h+2]) //ok
+(a[h][h]
*a[h+1][h+2]
*a[h+2][h+1]) //ok
+(a[h][h+2]
*a[h+1][h+1]
*a[h+2][h])));
printf("\n det(A) = %d\n",d);
return 0;
}
Vlw?