Documentos de Académico
Documentos de Profesional
Documentos de Cultura
return 0;
}
--------------------------------------------------------------
el total de perdidas es de 2504.75
-----------------------------------------------------------------
// Online C compiler to run C program online
#include <stdio.h>
//tiempo caida de servidor en minutos
//perdidas en dolares
int main() {
int tiempoServidorCaido = 5;
double mediaPerdidas = 500.95;
mediaPerdidas *= tiempoServidorCaido / 2; //reducimos las perdidad a la mitad
return 0;
}
---------------------------------------------------------------
el total de perdidas es de 1001.90
-----------------------------------------------------------------
ejercicio 2
// Online C compiler to run C program online
#include <stdio.h>
int main() {
int x = 1;
int y = 27;
if (x != y) { //comparador x distinto (!=) a y
printf("Felicitaciones! Ah usado los comparadores de forma correcta");
} else{
printf("Intente de nuevo");
}
return 0;
}
----------------------------------------------------------------------------------
Felicitaciones! Ah usado los comparadores de forma correcta
-----------------------------------------------------------------------------------
// Online C compiler to run C program online
#include <stdio.h>
int main() {
int x = 1;
int y = 1; // cambiamos el 27 x 1 para que ambos valores sean iguales
if (x != y) {
printf("Felicitaciones! Ah usado los comparadores de forma correcta");
} else{
printf("Intente de nuevo");
}
return 0;
}
---------------------------------------------------------------------------------------
Intente de nuevo
----------------------------------------------------------------------------------------
Ejercicio 3
#include <stdio.h>
int main() {
int x = 5; int y = 42;
int z = 10; int q = 5;
int h = 90; int j = 90;
int main() {
int x;
int y;
x = (2 + 3) * 5; // agregamos parentesis
y = 20 / (4 + 6); //agregamos parentesis
printf("x es %d\n", x);
printf("y es %d\n", y);
return 0;
}
----------------------------------------------------------------------------------
x es 25
y es 2
-----------------------------------------------------------------------------------
Ejercicio 5
int main() {
srand(time(NULL)); //genera numeros aleatorios
int coin = rand() % 2;
if(coin == 0) {
printf("\nCara\n");
}else {
printf("\nCruz\n");
}
return 0;
}
------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
Ejercicio 6
#include <stdio.h>
int main(){
int a = 1;
int b = 2;