fork download
  1. using static System.Console;
  2.  
  3. public class Program {
  4. public static void Main() {
  5. var larguraText = "2.00";
  6. var alturaText = "1.00";
  7. var percText = "30";
  8. var total = 0.0;
  9. if (double.TryParse(larguraText, out var largura) && double.TryParse(alturaText, out var altura) && double.TryParse(percText, out var perc)) {
  10. total = largura * altura * (perc / 100);
  11. }
  12. var totalText = total.ToString(); //só para fins didáticos do exemplo
  13. WriteLine(totalText);
  14. }
  15. }
  16.  
  17. //https://pt.stackoverflow.com/q/320182/101
Success #stdin #stdout 0.02s 16480KB
stdin
1.76
stdout
0.6