Notes
![]() ![]() Notes - notes.io |
// Função : Fazer três calculos com 2 vetores
// Autor : Daniel Pinheiro
// Data : 28/10/2015
// Seção de Declarações
var
a:vetor [1..5] de real
b:vetor [1..5] de real
sub:vetor [1..5] de real
soma:vetor[1..5] de real
mult: vetor [1..5] de real
i:inteiro
procedimento identificador()
inicio
escreval("|------------------------------------------------------|")
escreval("| CENTRO UNIVERSITÁRIO INTERNACIONAL - UNINTER |")
escreval("| LÓGICA DE PROGRAMAÇÃO E ALGORITMOS |")
escreval("|------------------------------------------------------|")
fimprocedimento
procedimento resultado_soma()
inicio
para i de 1 ate 5 faca
soma[i] <- a[i] + b[i]
escreval(soma[i])
fimpara
fimprocedimento
procedimento resultado_sub()
inicio
para i de 1 ate 5 faca
sub[i] <- a[i] - b[i]
escreval(sub[i])
fimpara
fimprocedimento
procedimento resultado_mult()
inicio
para i de 1 ate 5 faca
mult[i] <- a[i] * b[i]
escreval(mult[i])
fimpara
fimprocedimento
inicio
// Seção de Comandos
identificador()
escreva("Cite 5 números para a: ")
para i de 1 ate 5 faca
leia(a[i])
fimpara
escreva("Agora cite 5 números para b: ")
para i de 1 ate 5 faca
leia(b[i])
fimpara
limpatela
identificador()
escreval("Resultado da soma:")
resultado_soma()
escreval("Resultado da subtração:")
resultado_sub()
escreval("Resultado da multiplicação:")
resultado_mult()
fimalgoritmo
[30/10 16:46] Daniel Pinheiro: algoritmo "vetor de 30 posições"
// Função : Achar o Maior e Menor, obter a média dos impares e obter a soma dos pares
// Autor : Daniel Pinheiro
// Data : 23/10/2015
// Seção de Declarações
var
sec: vetor [1..30] de inteiro
procedimento identificador()
inicio
escreval("|------------------------------------------------------|")
escreval("| CENTRO UNIVERSITÁRIO INTERNACIONAL - UNINTER |")
escreval("| LÓGICA DE PROGRAMAÇÃO E ALGORITMOS |")
escreval("|------------------------------------------------------|")
fimprocedimento
procedimento gerador()
var
i:inteiro
inicio
aleatorio on
aleatorio 100,200
para i de 1 ate 30 faca
leia(sec[i])
fimpara
aleatorio off
limpatela
fimprocedimento
procedimento mostrar()
var
i:inteiro
inicio
para i de 1 ate 30 faca
escreva(sec[i]:4)
se (i mod 10) = 0 entao
escreval()
fimse
fimpara
fimprocedimento
funcao somapares():inteiro
var
i:inteiro
soma:inteiro
inicio
para i de 1 ate 30 faca
se (sec[i] mod 2) = 0 entao
soma <- sec[i]+soma
fimse
fimpara
retorne soma
fimfuncao
funcao mediaimpar():real
var
i,cont:inteiro
impar:inteiro
inicio
para i de 1 ate 30 faca
se (sec[i] mod 2) <> 0 entao
impar <- sec[i]+impar
cont <- cont+1
fimse
fimpara
retorne impar/cont
fimfuncao
funcao maior():real
var
i:inteiro
y_maior:inteiro
inicio
para i de 1 ate 30 faca
se sec[i] > y_maior entao
y_maior <- sec[i]
fimse
fimpara
retorne y_maior
escreval()
fimfuncao
funcao menor():real
var
i:inteiro
x_menor:inteiro
inicio
x_menor <- 200
para i de 1 ate 30 faca
se sec[i] < x_menor entao
x_menor <- sec[i]
fimse
fimpara
retorne x_menor
escreval()
fimfuncao
inicio
// Seção de Comandos
gerador()
identificador()
mostrar()
escreval()
escreval("Resultado da soma dos pares: ",somapares())
escreval("Resultado da soma dos impares: ",mediaimpar())
escreval("Maior número",maior())
escreval("Menor número",menor())
fimalgoritmo
[30/10 16:46] Daniel Pinheiro: algoritmo "Vetor Decrescente"
// Função : Manter decrescente os valores gerados aleatórios no vetor
// Autor : Daniel Pinheiro
// Data : 28/10/2015
// Seção de Declarações
var
v:vetor [1..50] de real
aux:real
i,j:inteiro
procedimento identificadori()
inicio
escreval("|------------------------------------------------------|")
escreval("| CENTRO UNIVERSITÁRIO INTERNACIONAL - UNINTER |")
escreval("| LÓGICA DE PROGRAMAÇÃO E ALGORITMOS |")
escreval("| Aleatório |")
escreval("|------------------------------------------------------|")
fimprocedimento
procedimento identificador()
inicio
escreval("|------------------------------------------------------|")
escreval("| CENTRO UNIVERSITÁRIO INTERNACIONAL - UNINTER |")
escreval("| LÓGICA DE PROGRAMAÇÃO E ALGORITMOS |")
escreval("| Decrescente |")
escreval("|------------------------------------------------------|")
fimprocedimento
inicio
identificadori()
aleatorio on
aleatorio 50,200
para i de 1 ate 50 faca
leia(v[i])
fimpara
aleatorio off
para j de 1 ate 49 faca
para i de 1 ate 50-j faca
se v[i] < v[i+1] entao
aux <- v[i]
v[i] <- v[i+1]
v[i+1] <- aux
fimse
fimpara
fimpara
identificador()
para i de 1 ate 50 faca
escreval(v[i])
fimpara
fimalgoritmo
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team