Sequência De Fibonacci
#1
Posted 19/04/2006, 19:33
Não sei se aqui é o local certo para isso mas... qual seria o algoritmo em Pascal para eu criar a sequência de Fibonacci? O meu professor deu isso na escola hoje mas nem ele conseguiu fazer direito. Eu havia conseguido, mas quando chegava em um certo número ele já estava dando errado. Então, como é possivel criar o algorito para a sequência de Fibonacci em Pascal?
- LarPhozyHah and JeffMalm curtiram esta postagem
> meu blog : http://www.manoelpdb.blogspot.com/
> galeria no deviantART : http://www.manoelpdb.deviantart.com/
#2
Posted 19/04/2006, 21:23
O critério é que o próximo número da seqüência é a soma dos dois números anteriores.
Onde você tem dificuldade? Diz onde é que eu te ajudo.
Abraços,
System
#3
Posted 20/04/2006, 19:54
Seguinte, primeiro pense como funciona a seqüência.
O critério é que o próximo número da seqüência é a soma dos dois números anteriores.
Onde você tem dificuldade? Diz onde é que eu te ajudo.
Abraços,
System
Sim, isso eu sei. Falando assim até parece fácil, mas na verdade não é tão simples.
Eu criei um algoritmo que até uns 5 primeiros números aparecem corretos, depois a lógica vai dando errado. Não sei porque. Eu criei um algoritmo mais ou menos assim:
- São três variaveis, uma para o número anterior, uma para o número atual e uma para o resultado;
- A variavel de resultado é a soma das outras duas variaveis;
- A variavel do número anterior inicia com zero, e a do número atual inicia com 1;
- Após acontecer a soma das variaveis que dão o resultado pro número atual, a variavel anterior recebe o valor da variavel atual, e a variavel atual soma mais um (tudo isso dentro de um laço de repetição);
- No final, escreve o valor da variavel do resultado final.
O que pode estar dando errado com esses meus pensamentos?
> meu blog : http://www.manoelpdb.blogspot.com/
> galeria no deviantART : http://www.manoelpdb.deviantart.com/
#4
Posted 28/04/2006, 18:59
Seguinte, primeiro pense como funciona a seqüência.
O critério é que o próximo número da seqüência é a soma dos dois números anteriores.
Onde você tem dificuldade? Diz onde é que eu te ajudo.
Abraços,
System
Sim, isso eu sei. Falando assim até parece fácil, mas na verdade não é tão simples.
Eu criei um algoritmo que até uns 5 primeiros números aparecem corretos, depois a lógica vai dando errado. Não sei porque. Eu criei um algoritmo mais ou menos assim:
- São três variaveis, uma para o número anterior, uma para o número atual e uma para o resultado;
- A variavel de resultado é a soma das outras duas variaveis;
- A variavel do número anterior inicia com zero, e a do número atual inicia com 1;
- Após acontecer a soma das variaveis que dão o resultado pro número atual, a variavel anterior recebe o valor da variavel atual, e a variavel atual soma mais um (tudo isso dentro de um laço de repetição);
- No final, escreve o valor da variavel do resultado final.
O que pode estar dando errado com esses meus pensamentos?
Seu pensamento tá quase certo...
O seu erro está na parte em negrito...
A lógica é a seguinte...
Anterior := 0;
Atual := 1;
(repetição)
Soma := Anterior + Atual;
Anterior := Atual;
Atual := Soma;
Agora desenvolva seu algoritmo
[]'s
Edição feita por: frlouzada, 28/04/2006, 19:08.
#5
Posted 30/04/2006, 16:43
<html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <script language="javascript"> <!-- function fibonacci() { qtd = document.forms[0].elements['qtd'].value - 1; var seq=new Array(1,1); if(qtd == 0) { window.alert("Você executou mal o script... dãããrrr..."); } else { var i=0; do { var numst=seq[seq.length - 2]; var numnd=seq[seq.length - 1]; var soma=numst + numnd; seq[seq.length]=soma; i++; } while(i<qtd) var j=0; do { alert("Casa: "+j+" Resultado: "+seq[j]); j++; } while(j<seq.length) } } //--> </script> <body> <form method="post" action="java script:fibonacci();"> <p> <input name="qtd" type="text" id="qtd" size="3"> </p> <p> <input type="submit" name="Submit" value="Calcular"> </p> </form> </body> </html>
Assim é a sequência em JS, passar para outra linguagem agora deve ser mais fácil.
Abraços.
P.S.: Não fui eu quem desenvolvi essa função, mas não me recordo o nome do autor.
Edição feita por: Dantetekanem, 30/04/2006, 16:44.
#6
Posted 30/04/2006, 20:32
#7
Posted 01/05/2006, 10:57
Consegui fazer direitinho agora! \o\
Abraços.
> meu blog : http://www.manoelpdb.blogspot.com/
> galeria no deviantART : http://www.manoelpdb.deviantart.com/
#8
Posted 17/09/2017, 15:48
buy generic isotretinoin internet visa with free shipping Cheap Ciali Pills Klebsiella Amoxicillin
Cialis 40 Mg Dosage <a href=http://cialtobuy.com>online pharmacy</a> Osu Cialis Commander
Priligy Kamagra viagra cialis No 1 Pharmacy
Come Acquistare Viagra Online
Find Discount Generic Elocon Cheap With Free Shipping <a href=http://cialtobuy.com>cialis price</a> Meloxicam
#9
Posted 22/09/2017, 19:29
Purchasing Stendra From Canada cialis price Amoxicillin And Indications And Uses Retin A Propecia Wikipedia Kamagra Compra Levitra Online cialis For Sale Shipped Ups Isotretinoin Acne Discount Medicine
#10
Posted 26/09/2017, 19:22
Cialis Thailandia cialis Viagra Generique En Belgique Precio Levitra Tabletas
#11
Posted 06/10/2017, 00:47
Effective Propecia Doses Best Prices Ed Meds Rem Again viagra Levitra Para La Mujer Levitra Von Bayer Viagra E Cardiopatia
Gel De Kamagra buy viagra online Cephalexin Antibiotic Class Cefotaxime
#12
Posted 09/10/2017, 15:51
Meshashringi Left Amoxicillin Out Over Night Generique Amoxicillin Distribuer Ces viagra Viagra A Partir De Quel Age Cialis Levitra Viagra Vergleich Buy Fluconazole Without A Prescription
Cialis Drogen Orlistat Weight Loss generic viagra Cialis Viagra Achat Generic Propecia Accutane
Propecia Parafarmacia Purchase Orlistat 60 Mg viagra online prescription Priligy Ricetta Medica
Viagra Generico Cialis Levitra No Prescription Necessary viagra Non Prescription Cymbalta
#13
Posted 13/10/2017, 07:25
Where to order real isotretinoin drugs on line Cialis By Internet Buy Cialus Cheap acquista vardenafil Viagra Probepackung Kostenlos Ampicillin 500
#15
Posted 16/10/2017, 04:51
Discounts! best hair putty
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).
READ MORE
XIAOMI REDMI Note 3 32GB 4G Phablet-204.75 $
Cylinder Silver Plated Cuff Links ( 66.40 $)
Lace frontal closure 13x4 brazilian body wave lace frontal ear to ear lace frontal xbl brazilian virgin hair body wave frontal ( 92.50 $)
Gemini link striped oblong wool scarf ( 149.78 $) Tory Burch
LCD Keyboard Wireless SMS Home GSM Alarm systems House intelligent auto Burglar Door Security Alarm System kit+Smoke detector ( 61.00 $)
TC-X Guaranteed Car LED Headlights H7 H1 H3 H11H8H9 HB39005 HB49006 H27 880881 7000LM Super Power Replacement LED Bulb Kit ( 42.84 $)
Free shipping led fog lights lamps for mitsubishi pajero 2007~2009 clear lens pair set + wiring kit fog light set ( 105.58 $)
JJRC H28 H28C H28W Original USB Cable RC Quadcopter Spare Part ( $2.87 )
DOOGEE X6 Pro 4G Phablet-98.22 $
2pcs Outdoor 11 LED Clip-on Cap Lamp ( $3.59 )
Suaoki Solar Panel Retractable Camping LED Lantern-16.99 $
LETV Leeco One X600 32GB ROM 4G Phablet-152.21 $
AL Sport Black Aluminium Rollerball Fountain Pen Set ( 178.00 $)
Sex toys for woman vibrators,g-spot waterproof vibrator for women sex toys anal nipple vibrator sex products magic tool sex toy ( 36.27 $)
Best salon barber instant hair styling powder toppik hair fiber thickening keratin hair fibre concealer hair loss 27.5g ( 25.98 $)
Discounts! 10 best makeup products
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).
READ MORE
Ceremoniya podpisaniya dogovora mezhdu Rossiej, Krimom i Sevastopolem
Vintage Poster Star Wars kraft paper white soldiers retro nostalgia decorative painting darth vader stormtrooper yoda 42X30CM ( 1.80 $)
Internet skateshop Proskater.ru - Quality equipment for riders and the city - snowboard jackets, skate wear, skateboards, snowboards and more
AGM X1 4G Phablet-340.99 $
Hubsan X4 H502E 2.4G Drone ( 79.09 $)
Car Dvr 1080P Dual Lens Dash Camera Mirror Digital Recorder With Rearview Camera Video Recorders Camcorder Vehicles Registrar ( 46.65 $)
Silver Plated European Flag Button Covers ( 57.60 $)
Ladies handbag casual tote canvas bag bolsa feminina stripe women canvas bags large messenger bag women patchwork handbags ( 25.73 $)
Grade 10a malaysian virgin hair weave malaysian deep curly virgin hair 4pcs malaysian curly virgin hair remy human hair bundles ( 74.00 $)
Planet Sports
2016 police tactical vest outdoor camouflage military body armor sports wear hunting vest army swat molle vest black ( 90.00 $)
Lyubov po pravilam i bez
Jet Set Travel Large Phone Case ( 110.00 $)
High Quality Copper 7 pcs Makeup Brush Set New Colorful Pinceaux Maquillage Beautiful Powder Blush Eyeshadow Make Up Brushes ( 17.99 $)
UNIC UC40+ LCD Projector-69.80 $
Discounts! best product marketing
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).
READ MORE
Susanna, Syuzanna
Starry red turquoise leather and suede sandal ( 331.66 $) Paula Cademartori
XiaoMi Mi4S 4G Smartphone-314.67 $
2016 female coin purse single zipper clutch bag ladies' wallets fashion women's purses handbags free shipping 2015002 ( 13.98 $)
Unprocessed7a virgin hair lace closure 4 ( 61.25 $)
Annajolly women lace floral sexy soild cup underwear bra fashion women clothing intimates underwire byustgalter hot sale 7314 ( 20.75 $)
20 Mini Beautiful Japanese Red Maple Bonsai Seeds, DIY Bonsai ornamental flowerpot ( 1.79 $)
Rc drone multicopter 6-axle aircraft kit f550 hexa-rotor air frame gps apm2.8 flight control no battery no txrx f05114-ax ( 136.31 $)
EKEN H9 Ultra HD 4K Action Camera-54.29 $
Umi Max 4G Phablet-187.60 $
Teclast Tbook 16 Pro 2 in 1 Tablet PC-230.93 $
100 seeds mixed color cineraria seeds potted seed flower seeds for home garden promotion ( 0.55 $)
Jewelrypalace 8.6ct genuine rainbow fire mystic topaz dangle earrings 925 solid sterling silver luxury gift for women jewelry ( 97.93 $)
Bikini swimwear swimsuit women biquinis bikini set swimsuit lady bathing suit female swimwear swimming suit for women plavky ( 25.14 $)
4 Bundles Brazilian Body Wave 100g 7A Unprocessed Brazilian Virgin Hair Body Wave Nadula Hair Products Top Brazilian Human Hair ( 72.00 $)
Discounts! product description page design
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).
READ MORE
KOLIBELNAYa BEDNIH
Original xiaomi mi power bank 2 10000mah external battery portable mobile backup bank mi charger for ( 24.99 $)
Marrant crazy horse genuine leather bag casual men handbags men crossbody bags men s travel bag ( 98.00 $)
Shop the most current gadgets, RC helicopters and quadcopters, smartphones and trendy clothes on Banggood.com
Hot Selling 7Pcsset 6A Remy Virgin Brazilian Hair Clip In Extension Straight Human Hair Clip in #4 70g Remy Virgin Hair Clip ( 28.26 $)
2 X Plug&Play 90W 9000LM H1 H3 H4 H7 H8 H10 H11 H13 9005HB3 9006HB4 880 D2S COB LED Bulbs DRL Car Fog Headlight Auto Lamp Bulb ( 46.98 $)
8GB Ram+128GB SSD+1000GB HDD Ultrathin Quad Core J1900 Fast Running Windows10 system Laptop Notebook Computer, free shipping ( 399.00 $)
Classic Butterfly Bangles Bracelets Fashion Glass Cabochon Bracelet for Women Newest Bronze Leather Bracelet ( 1.35 $)
Simple solid color round neck short sleeve men's t-shirt ( 11.39 $)
7a soft unprocessed malaysian straight virgin hair natural black color malaysian virgin hair straight 4pcs lot human hair weave ( 45.00 $)
Cheerson CX — 10W Quadcopter-28.89 $
Small Panthers Goldtone Brass wGlass Pearls Drop Earrings ( 88.00 $)
Jewelry store lines of Love. A network of jewelry stores
Unisex cheapest canvas cartoon candy color retro small coin change purse key car pouch little money ( 0.99 $)
2015 new hot selling professional police digital breath alcohol tester breathalyzer at838 free shipping dropshipping ( 9.99 $)
0 user(s) are reading this topic
0 membro(s), 0 visitante(s) e 0 membros anônimo(s)