Documentos de Académico
Documentos de Profesional
Documentos de Cultura
printf/scan
Programa 1
Código:
/*
* Progama 1 Practica 1
* 07/09/23
* */
#include <stdio.h>
{
float r1;
float r2;
float req_serie;
float req_paralelo;
scanf("%f", &r1);
scanf("%f", &r2);
req_serie = r1 + r2;
return 0;
}
Programa 2
Código:
/*
* Programa 2 Practica 1
* 07/09/23
* */#include <stdio.h>
float alt;
float base1;
float base2;
float area;
return 0;
}
Programa 3
Código:
/*
* Progama 3 Practica 1
* 08/09/23
* */
#include <stdio.h>
int num1;
int num2;
float media;
int cociente;
int resto;
scanf("%d", &num1);
scanf("%d", &num2);
if (num1>= num2) {
cociente = num1/num2;
resto = num1%num2;
printf("El cociente del primer numero entre el segundo es %d y el resto es %d. \n", cociente,
resto);
} else {
cociente = num2/num1;
resto = num2%num1;
printf("El cociente del segundo numero entre el primero es %d y el resto es %d. \n", cociente,
resto);
return 0;
}
Programa 4
Código:
/*
* Progama 4 Practica 1
* 08/09/23
* */
#include <stdio.h>
float x;
float y;
if (x<=3){
y =2*x*x/3;
}else{
y =x*x*x/5;
}
printf ("Para x igual a %.2f, el valor de f(x) es igual a %.2f \n", x, y);
return 0;