Guest User

Untitled

a guest
Jan 18th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. List<string> siglas = new List<string>() {
  2. "K", // Kilo
  3. "M", // Mega
  4. "G", // Giga
  5. "T", // Tera
  6. "Y" // Yota
  7. };
  8. int numero = 10231204124; // ou qualquer outro número
  9. string resultado;
  10.  
  11. while (numero > 1000 && siglas.Count > 0) {
  12. numero /= 1000;
  13. resultado = numero.ToString() + siglas[0];
  14. siglas.RemoveAt(0);
  15. }
Add Comment
Please, Sign In to add comment