Ejercicios de lenguaje C++
RIVERTS010 XDTrabajo21 de Agosto de 2022
974 Palabras (4 Páginas)102 Visitas
[pic 1]
#include <stdio.h>
int main()
{
int num;
float resultado;
printf("Ingrese el tiempo en horas por favor: ");
scanf("%d",&num);
resultado=num*3600;
printf("%d horas son %f en segundos", num,resultado);
return 0;
}
[pic 2]
#include <stdio.h>
int main()
{
float nota1,nota2,nota3,R1;
printf("Ingrese la primer nota\n");
scanf("%f",¬a1);
printf("Ingrese la segunda nota\n");
scanf("%f",¬a2);
printf("Ingrese la tercera nota\n");
scanf("%f",¬a3);
R1=(nota1+nota2+nota3)/3;
if (R1>=3.0)
{
printf("Gano la materia\n");
}
if (R1>=2.5 && R1<3.0)
{
printf("Puede habilitar la materia\n");
}
if (R1<2.5)
{
printf("Perdio la materia\n");
}
return 0;
}
[pic 3]
#include <stdio.h>
int main()
{
float altura,peso,R1;
printf("Ingrese su peso\n");
scanf("%f",&peso);
printf("Ingrese su altura\n");
scanf("%f",&altura);
R1=peso/(altura*altura);
if (R1<18.5)
{
printf("Peso bajo");
}
if (R1>18.5 && R1<24.9)
{
printf("Peso normal");
}
if (R1>25 && R1<29.9 )
{
printf("Sobre peso");
}
if (R1>30)
{
printf("Obesidad");
}
return 0;
}
[pic 4]
#include <stdio.h>
int main()
{
float R1,R2,a,res1;
printf("Ingrese la resistencia 1\n");
scanf("%f",&R1);
printf("Ingrese la resistencia 2\n");
scanf("%f",&R2);
printf("Ingresa 1 para calcularlo en serie\nIngresa 2 para calcularlo en paralelo\n");
scanf("%f",&a);
if(a==1)
{
res1=R1+R2;
printf("El valor de la resistencia es: %f",res1);
...