Created
March 22, 2012 16:43
-
-
Save eloyesp/2159506 to your computer and use it in GitHub Desktop.
Ejercicios C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
int main() | |
{ | |
float radio, perimetro, area; | |
printf("Ingrese el radio: "); | |
scanf("%f", &radio); | |
perimetro= M_PI*(radio*2); | |
area= M_PI*(radio*radio); | |
printf("el perimetro es: %f \n", perimetro); | |
printf("el area es: %f \n", area); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int numero; | |
printf("Ingrese un numeo entero: "); | |
scanf("%i", &numero); | |
if ( numero % 2 == 0 ) { | |
printf("El numero es par\n"); | |
} else { | |
printf("El numero es impar\n"); | |
} | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
float a, b, x; | |
printf("ingrese el valor de a: \n"); | |
scanf("%f", &a); | |
printf("ingrese el valor de b: \n"); | |
scanf("%f", &b); | |
x=(-b)/a; | |
if (a==0){ | |
if (b==0) | |
printf("La ecuacion es indeterminada\n"); | |
else | |
printf("La ecuacion no tiene solucion"); } | |
else | |
printf("El sistema tiene solucion x = %f \n", x); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
int a, b, max; | |
printf ("Dame el primer numero: "); | |
scanf ("%d", &a); | |
printf ("Dame el segundo numero: "); | |
scanf ("%d", &b); | |
if (a >= b) { | |
max = a; | |
} else { | |
max = b; | |
} | |
printf("El maximo es %i", max); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment