Questions tagged as 'algoritmo'

5
answers

Simple solution for Fibonacci algorithm

I have this statement in hand:    Given the Fibonacci sequence 1 1 2 3 5 8 13 ... n, write an algorithm to generate the sequence up to the nth term, which should be provided by the user. For example, if the user entered the number 40, 40 numb...
asked by 09.06.2017 / 05:46
3
answers

Fibonacci sequence does not work [closed]

I have a problem with the output of the Fibonacci sequence and I can not identify where the error is. Here's the code: #include <stdio.h> #include <stdlib.h> int main(){ int i, Fib[100], n; scanf("%d",&n); printf("0 "); fo...
asked by 07.10.2017 / 17:14
3
answers

How can I make this code more functional in Javascript?

This code solves the problem of finding the num prime between 0 and 10,000: function PrimeMover(num) { var counter = 0; var primes = []; for (var i=2; i<=10000; i++){ for (var j = 2; j<i; j++){ if (i%j===0) { cou...
asked by 23.06.2015 / 23:35
2
answers

How to do Table Test for certain algorithm?

I have this algorithm, in a pseudocode: Knowing that n1 gets the value 20. inicio inteiro: n1,n2,n3; leia (n1); n2<-n1*3; n3<-n1-1+n2; imprima("O resultado final será n3=",n3); fim. Exemplifying:    n2 (Receives resul...
asked by 22.06.2016 / 02:18
1
answer

Fibonacci Sequence

I need to exercise on the Fibonacci sequence:    Each new term in the Fibonacci sequence is generated from the sum   of the 2 previous terms. If we start with 1 and 2, the first ten   numbers are: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... Consid...
asked by 06.05.2017 / 21:31
2
answers

Sum of even numbers and multiplication of odd numbers in a range

   Read two numbers where y is greater than x, calculate the sum of the numbers   pairs of this range of numbers, including the numbers entered;   calculate and show the multiplication of the odd numbers of this   range, including those typed;...
asked by 06.07.2017 / 23:42
1
answer

Inequality in C language

Data: Brutus is 1.84m and weighs 122kg and Olivia is 1.76m and weighs 45kg. IMC = peso/(altura*altura); IMC: 18,5 a 25 -----> Saudável I want to create an algorithm that prints the MINIMUM amount of pounds that Brutus and Olivia must...
asked by 24.08.2017 / 17:55
2
answers

Array lookup within another array in Java

I need to compare two two-dimensional arrays ( int[][] ) of different sizes, the two being formed by integer values (1 or 0), to check if there is the smaller array inside the larger array. Larger array example: Smallestmatrixexample:...
asked by 20.10.2015 / 03:13
1
answer

What is the master theorem?

What is the master theorem? What is its importance in analyzing algorithm complexity?     
asked by 04.10.2014 / 06:18
1
answer

Divisible - portugol (VISUALG)

I have the following question and below what I have tried but it is not showing only the divisible numbers that is my intention. I'm doing the test by typing the number 8, the correct program was to say " 8 is divisible by 8 and by 2 " Wri...
asked by 01.06.2017 / 04:12