fork(1) download
  1. using static System.Console;
  2.  
  3. namespace POOTeste {
  4. public class Program2 {
  5. public static int Main() {
  6. Write("Digite um número positivo ou negativo: ");
  7. if (!int.TryParse(ReadLine(), out var numero)) return 1;
  8. Write($"O valor inverso é {-numero}");
  9. return 0;
  10. }
  11. }
  12. }
  13.  
  14. //https://pt.stackoverflow.com/q/406973/101
Success #stdin #stdout 0.02s 16096KB
stdin
1
stdout
Digite um número positivo ou negativo: O valor inverso é -1