Advertisement
Aluneth

Clase 31-3-25

Mar 31st, 2025
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.74 KB | Software | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. /*int main()
  5. {
  6.  
  7.     int sueldo;
  8.     printf("Ingrese un sueldo: ");
  9.     scanf("%d", &sueldo);
  10.     if (sueldo > 3000) {
  11.         printf("\nDebe abonar impuestos\n");
  12.     };
  13.  
  14.  
  15.     //printf("Hello world!\n");
  16.     return 0;
  17. }
  18. */
  19.  
  20.  
  21. /* int main ()
  22. {
  23.     int num1, num2;
  24.     printf("Ingrese un numero: ");
  25.     scanf("%d", &num1);
  26.     printf("Ingrese otro numero: ");
  27.     scanf("%d", &num2);
  28.  
  29.     if (num1 > num2)
  30.     {
  31.  
  32.         printf("El primer numero es el mayor: %d", num1);
  33.     }
  34.     else
  35. {
  36.     printf("El segundo numero es el mayor: %d", num2);
  37.     }
  38.  
  39.     return 0;
  40. } */
  41.  
  42.  
  43. /* int main ()
  44. {
  45.     int numero;
  46.     printf("Ingrese un numero entero positivo entre 1 y 99: ");
  47.     scanf("%d", &numero);
  48.  
  49.     if (numero < 1 || numero > 99)
  50.     {
  51.         printf("El numero no esta entre 1 y 99");
  52.     }
  53.     else if (numero < 10 )
  54.     {
  55.         printf("El numero tiene una sola cifra");
  56.  
  57.     }
  58.     else
  59.     {
  60.  
  61.         printf("El numero tiene dos cifras");
  62.     }
  63.  
  64.  
  65.     return 0;
  66. } */
  67.  
  68.  
  69. /* Confeccionar un programa que pida por teclado tres notas de un alumno, calcule el promedio e imprima alguno de estos mensajes:
  70. Si el promedio es >=7 mostrar "Promocionado".
  71. Si el promedio es >=4 y <7 mostrar "Regular".
  72. Si el promedio es <4 mostrar "Reprobado". */
  73. /* int main ()
  74. {
  75.  
  76.  
  77.     int nota1, nota2, nota3;
  78.     float promedio;
  79.     printf("Ingrese las 3 notas del alumno\n");
  80.     printf("Nota 1: ");
  81.     scanf("%d", &nota1);
  82.     printf("Nota 2: ");
  83.     scanf("%d", &nota2);
  84.     printf("Nota 3: ");
  85.     scanf("%d", &nota3);
  86.  
  87.     promedio = (nota1 + nota2 + nota3) / 3;
  88.  
  89.     if (promedio < 4)
  90.     {
  91.         printf("Reprobado");
  92.     }
  93.     else
  94.     {
  95.         if (promedio < 7)
  96.             printf("Regular");
  97.         else
  98.         {
  99.  
  100.             printf("Promocionado");
  101.         }
  102.     }
  103.     return 0;
  104.  
  105. } */
  106.  
  107.  
  108. /* int main ()
  109. {
  110.     int num1, num2, num3;
  111.     printf("Ingrese el numero 1: ");
  112.     scanf("%d", &num1);
  113.     printf("Ingrese el numero 2: ");
  114.     scanf("%d", &num2);
  115.     printf("Ingrese el numero 3: ");
  116.     scanf("%d", &num3);
  117.  
  118.     if (num1 > num2)
  119.     {
  120.         if (num1 > num3)
  121.         {
  122.             printf("El numero mayor es: %d", num1);
  123.         }
  124.     }
  125.     else
  126.     {
  127.         if (num2 > num3)
  128.         {
  129.             printf("El numero mayor es: %d", num2);
  130.         }
  131.         else
  132.         {
  133.             printf("El numero mayor es: %d", num3);
  134.         }
  135.  
  136.     }
  137.  
  138.  
  139.     return 0;
  140. } */
  141.  
  142. /* Un postulante a un empleo, realiza un test de capacitación, se obtuvo la siguiente información: cantidad
  143. total de preguntas que se le realizaron y la cantidad de preguntas que contestó correctamente. Se pide
  144. confeccionar un programa que ingrese los dos datos por teclado e informe el nivel del mismo según el porcentaje
  145. de respuestas correctas que ha obtenido, y sabiendo que:
  146.  
  147.     Nivel máximo:  Porcentaje>=90%.
  148.     Nivel medio:    Porcentaje>=75% y <90%.
  149.     Nivel regular:  Porcentaje>=50% y <75%.
  150.     Fuera de nivel: Porcentaje<50%. */
  151.  
  152.  
  153. int main()
  154. {
  155.     int preguntas, resCorrectas;
  156.     float porcentaje;
  157.     printf("Cantidad de preguntas totales: ");
  158.     scanf("%d", &preguntas);
  159.     printf("Cantidad de respuestas correctas: ");
  160.     scanf("%d", &resCorrectas);
  161.  
  162.     porcentaje = resCorrectas * 100 / preguntas ;
  163.  
  164.     if (porcentaje >= 90)
  165.     {
  166.         printf("Nivel maximo: %.2f", porcentaje);
  167.     }
  168.     else
  169.     {
  170.         if (porcentaje >= 75)
  171.         {
  172.             printf("Nivel medio: %.2f", porcentaje);
  173.         }
  174.  
  175.         else if (porcentaje >= 50)
  176.         {
  177.             printf("Nivel regular: %.2f", porcentaje);
  178.         }
  179.         else
  180.         {
  181.             printf("Fuera de nivel: %.2f", porcentaje);
  182.         }
  183.     }
  184.     return 0;
  185. }
  186.  
  187.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement