Calculadora En c
#include #include #include int main() { float a,b,c,d,e; printf("\t \t \t\t IPN \n"); printf("\t \tprintf("\t \t printf("\t ESIME\n"); FUNDAMENTOS DE PROGRAMACION \n"); MATA FERNANDEZ JHONATAN NOE\ \n");
menu: // ESTO NOS SERVIRÁ PARA REGRESAR printf("Queoperacion desea realizar \n"); printf("\n"); printf(" printf(" scanf("%f",&d); if(d==1) { printf(" scanf("%f",&a); printf(" scanf("%f",&b); printf(" Introduce eltercer valor:\n"); Introduce el segundo valor:\n"); Introduce el primer valor:\n"); 1.-suma 3.-multiplicacion 2.-resta\n"); 4.-division\n");
scanf("%f",&e); c=a+b+e; printf("Tu resultado es:%f",c); } else if (d==2) { printf(" scanf("%f",&a); printf(" scanf("%f",&b); c=a-b ; printf("tu resultado es:%f",c); } else if (d==3) {printf(" scanf("%f",&a); printf(" scanf("%f",&b); printf(" scanf("%f",&e); c= a * b * e ; printf("tu resultado es:%f",c); } else if (d==4) { printf("scanf("%f",&a); Introduce el primer valor:\n"); Introduce el tercer valor:\n"); Introduce el segundo valor:\n"); Introduce el primer valor:\n"); Introduce el segundovalor:\n"); Introduce el primer valor:\n");
printf(" scanf("%f",&b); c = a / b;
Introduce el segundo valor:\n");
printf("Tu resultado es:%f",c); } else {printf("ESTA OPCION NO ES CORRECTA"); } printf("\n"); printf("Qieres realizar otra operacion: 1___si scanf("%f",&e); 2___no \n");
while(e==1)//MIENTRAS { goto menu;//AQUÍ NOS REGRESA A LA POSICIÓN EN LA CUAL COLOCAMOS EL MARCADOR }
if (d==2) { exit(1); } else { printf("ESTA OPCION NO ES CORRECTA");
} return 0;
}
Regístrate para leer el documento completo.