seergiomv

ejercicio 6.2

Oct 4th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.     int r, t; // también se puede hacer con float y evito paso 10
  5.     printf("Introduce el número total de preguntas: \n");
  6.     scanf("%d", &t);
  7.     printf("Introduce el número de preguntas respondidas correctamente: \n");
  8.     scanf("%d", &r);
  9.  
  10.     float y = ((float) r)/t*100;
  11.     if (y >= 90){
  12.         printf("Nivel máximo");
  13.     }
  14.     if (y >= 75 && y < 90){
  15.         printf("Nivel medio");
  16.     }
  17.     if (y >= 50 && y <75){
  18.         printf("Nivel regular");
  19.     }
  20.     if (y < 50){
  21.         printf("Fuera de nivel");
  22.     }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment