Display whether the person is of legal age or not

Can anyone help me with an exercise in visualg? it is as follows: the exercise asks like this:

Write a program that reads a person's age. At the end, display whether that person is of legal age or not.

Console

What is your age: 17.

Of legal age = false

I want you to present at the end false result for those who are under 18 and true for those who are over 18.

algoritmo"exercício"
var
// Seção de Declarações das variáveis 
  Idade: inteiro
  Valor: logico

inicio
// Seção de Comandos, procedimento, funções, operadores, etc... 
  Idade <- (18)
  escreva ("Digite sua idade: ")
  leia (idade)
  escreva
fimalgoritmo

O code I made is the one above but it is giving error.

Author: Ivanilson Cavalcante, 2017-07-21

2 answers

Missing to add the check / comparison of the age with the desired value 18 years, this is done with the statement se.

se (idade >= 18) entao
   escreva ("maior de idade")
senao
   escreva ("menor de idade")
fimse
 3
Author: rray, 2017-07-21 12:21:29

Can do like this:

 algoritmo"exercicio"
 var

 idade: inteiro

 inicio
 // Seção de Comandos, procedimento, funções, operadores, etc... 

 escreva ("Digite sua idade: ")
 leia (idade)
 se(idade>=18)entao
 escreval("MAIOR DE IDADE")
 senao

 escreval(idade," anos idade")
 escreval("CONSIDERADO MENOR DE IDADE")
 fimse
 fimalgoritmo
 1
Author: YODA, 2017-10-22 13:39:52