Académique Documents
Professionnel Documents
Culture Documents
FACULTAD DE MINAS
ESCUELA DE MECATRNICA
Asignatura:ARQUITECTURA DE COMPUTADORES
Examen: PRIMER PARCIAL
Nombre del estudiante:
Nombre del docenteHUGO DE JESS MESA YEPES
Grupo: 01
Nota:
Valor: 25%
Documento:
Fecha: Octubre 25 de 2012
2. (25%)
#include <stdio.h>
void main(void){
int n, i = 1, m;
float fact, suma =
printf("Ingrese el
scanf("%d",&n);
do {
fact = 1;
m = i;
while(m > 1){
fact *= m;
m--;
}
suma+=fact;
printf("\t %d!
i++;
}while(i <= n);
printf("\n\tsuma =
}
#include <stdio.h>
#define SIZE 3
void main(void) {
double matriz[SIZE][SIZE];
double vector[SIZE];
double solucion[SIZE];
double sum;
int i,j;
printf("Introduce los datos de la matriz:\n");
for(i=0; i<SIZE ; i++) {
for(j=0; j<SIZE; j++) {
printf("\nElemento (%d,%d): ", (i+1), (j+1));
scanf(" %lf", &matriz[i][j]);
}
}
printf("\n\nIntroduce los datos del vector:\n");
for(i=0; i<SIZE ; i++) {
printf("\nElemento %d: ", (i+1));
scanf("%lf", &vector[i]);
}
for(i=0; i<SIZE; i++) {
sum=0;
for(j=0; j<SIZE; j++) {
sum+=matriz[i][j]*vector[j];
}
solucion[i]=sum;
}
printf("\nEl vector solucion es:\n");
for(i=0; i<SIZE; i++) {
printf("Elemento %d = %lf\n", i+1, solucion[i]);
}
}
0;
valor de n: ");
= %0.f \n",i,fact);
%0.f\n\n",suma);
ebx,OFFSET intArray
ecx,LENGTHOF intArray
cmp
jnz
add
loop
jmp
L1:
found:
movsx eax,WORD PTR [ebx]
call WriteInt
jmp
quit
notFound:
mov
call
edx,OFFSET noneMsg
WriteString
call
exit
crlf
quit:
main ENDP
END main
Grupo: 02
Nota:
Valor: 25%
Documento:
Fecha: Octubre 25 de 2012
2. (25%)
int main(){
int n, num = 2, esPrimo, limite;
while(num<=100){
esPrimo = 1;
n = 2;
limite = (num);
while(n <= limite && esPrimo){
if(num % n == 0) //divisible entre n
esPrimo = 0;
n++;
}
if(esPrimo)
cout << num << " ";
num++;
}
getch();
return 0;
}
/* fichero determin.c */
#include <stdio.h>
#define SIZE 3
void main(void) {
double mat[SIZE][SIZE];
double det;
int i, j;
FILE *fi;
printf("Introduzca los elementos de la mat 3x3:\n");
for (i=0; i<SIZE; i++)
for (j=0; j<SIZE; j++) {
scanf("%lf", &mat[i][j]);
}
det = mat[0][0]*mat[1][1]*mat[2][2];
det += mat[0][1]*mat[1][2]*mat[2][0];
det += mat[1][0]*mat[2][1]*mat[0][2];
det -= mat[0][2]*mat[1][1]*mat[2][0];
det -= mat[0][1]*mat[1][0]*mat[2][2];
det -= mat[0][0]*mat[2][1]*mat[1][2];
printf("La mat introducida es:\n");
for (i=0; i<SIZE; i++) {
for (j=0; j<SIZE; j++)
printf("%8.2lf", mat[i][j]);
printf("\n");
}
printf("\nY su det es: %12.4lf\n", det);
}
L1:
mov
mov
call
call
call
Loop
main ENDP
END main
eax,BlueTextOnGray
call SetTextColor
call Clrscr
mov
esi,OFFSET arrayD
mov
ebx,TYPE arrayD
mov
ecx,LENGTHOF arrayD
call
DumpMem
call
Crlf
ecx,COUNT
edx,OFFSET prompt
WriteString
ReadInt
Crlf
call
WriteInt
call
Crlf
call
WriteHex
call
Crlf
call
WriteBin
call
Crlf
call
Crlf
L1
call
WaitMsg
mov
eax,DefaultColor
call
SetTextColor
call
Clrscr
exit