Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Windows Program Console
#2
Hello!

Below is the first example. Console program name: add.n7a

Code:
' Programa para somar dois números recebidos do usuário
' Program to add two numbers received from the user

' Função principal
function main()
    ' Variáveis para armazenar os números e o resultado
    ' Variables to store the numbers and the result
    num1 = 0
    num2 = 0
    resultado = 0

    ' Solicitar o primeiro número
    ' Prompt for the first number
    pln("Enter the first number:")
    num1 = rln() ' Ler o primeiro número do console
                 ' Read the first number from the console
  
    ' Solicitar o segundo número
    ' Prompt for the second number
    pln("Enter the second number:")
    num2 = rln() ' Ler o segundo número do console
                 ' Read the second number from the console
 
    ' Realizar a soma
    ' Perform the sum
    resultado = int(num1) + int(num2)

    ' Exibir o resultado
    ' Display the result
    pln("The result of the sum is: " + resultado)
endfunc

' Chamar a função principal
' Call the main function
main()
Reply


Messages In This Thread
Windows Program Console - by dantas72 - 07-14-2024, 09:39 PM
RE: Windows Program Console - by dantas72 - 07-15-2024, 01:08 AM
RE: Windows Program Console - by Marcus - 07-15-2024, 01:30 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)