Está en la página 1de 2

// Ejercicio con Sistemas Numericos

// Modif. por M. Solares


#include <stdio.h>
#include <conio.h>
#include <math.h>
int main()
{
int e, d1=0,d=0;
char b;
regresa:
clrscr();
for(e=0;e<=9;++e)
{
printf("Introduce uno a uno los digitos binarios (1 ¢ 0, 9 para terminar): ");
scanf("%d",&d);
if(d == 9)
goto imprime;
if(d>1 || d<0)
goto regresa;
d1 = d1 + (d*pow(2,e));
}
imprime:
printf("el decimal es: %d", d1);
printf("\n\nDame un numero decimal: ");
scanf("%d",&d);
printf("Del numero decimal: %d, su octal es %o y su hexadecimal es: %x",d,d,d);
printf("\n\nDame un numero octal: ");
scanf("%o",&d);
printf("Del numero octal: %o, su hexadecimal es: %x",d,d);

printf("\n\nDame un numero hexadecimal: ");


scanf("%x",&d);
printf("Del numero hexadecimal: %x, su decimal es: %d",d,d);
getch();
}
// SIMIL DE LAS COMPUERTAS LOGICAS Y LOS OPERADORES LOGICOS
// AUTOR: M. SOLARES R.
#include <stdio.h>
#include <conio.h>
#include <math.h>
int main()
{textbackground(1);
textcolor(YELLOW);
clrscr();
int A, B,ch, ch1;
ch=168;
ch1=26;
gotoxy(23,8);
printf("Proporcione dos digitos binarios,");
gotoxy(13,9);
printf("UNO PARA 'A' Y OTRO PARA 'B' \(0=falso,1=verdadero): ");
scanf("%d, %d", &A, &B);
gotoxy(15,11);
printf("%c ES VERDAD QUE A y B ? %c %d\n", ch, ch1, A && B);
gotoxy(15,13);
printf("%c Es FALSO QUE A y B ? %c %d\n", ch, ch1, A || B);
gotoxy(15,15);
printf("%c ES FALSO QUE B y A ? %c %d\n", ch, ch1, B || A);
gotoxy(15,17);
printf("%c INVERSO DE 'A' ? %c %d\n", ch, ch1, ! A);
gotoxy(15,19);
printf("%c INVERSO DE 'B' ? %c %d\n", ch, ch1, ! B);
getch();
}

También podría gustarte