Advertisement
AntonioVillanueva

Calculo de Notas en Rust ejercicio

Jan 24th, 2025
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.36 KB | None | 0 0
  1. #[warn(unused_variables)]
  2.  
  3. fn calificacion (nota:i8)->&'static str{
  4.  
  5.     if nota > 95 {return "A+";}
  6.     if (nota > 90) & (nota <= 95)  {return "A";}
  7.     if (nota > 80) & (nota <= 90)  {return "B";}
  8.     if (nota > 60) & (nota <= 80)  {return "C";}
  9.      "D"
  10. }
  11.  
  12. fn main (){
  13.     for nota in [95,90,95,80,90,60,80,60]{
  14.         println! ("{} => {} ",nota,calificacion(nota));
  15.     }
  16.  
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement