Questions tagged as 'algoritmo'

1
answer

How to create christmas tree algorithm in PHP

I'm doing the following code, however PHP does not add and assign zero: <?php $linha = "*"; for($i = 0; $i < 6; $i++){ echo($linha)."<br>"; $linha += "*"; //aqui o php nao soma } ?> The output of this code was meant...
asked by 29.09.2015 / 04:59
2
answers

Problem with Struct in C

In this code: #include <stdio.h> #include <stdlib.h> //Usando o struct(Estruturas) struct cadastro { char nome[50]; int idade; char rua[50]; int numero; }; int main() { printf("Digite suas informacaoes...
asked by 18.05.2015 / 02:45
1
answer

Module Calculation Execution Time (%)

   Variable declaration: var x= 200; var y= 50;    Module: var resposta = x % y;    What the module should do, I believe (calculate): s1 = x / y; s2 = s1 * y; resposta = s2 - x; The question itself is: Does the calculati...
asked by 02.07.2014 / 16:09
1
answer

How to check if the Sliding puzzle is solvable?

Hello, I'm developing a little work where I need to solve a puzzle, precisely this puzzle: Itbasicallyconsistsofslidingthepiecestothewhitespaceinordertoleavetheminorder(orinthedesiredstate).Example: link But before starting the resolutio...
asked by 02.10.2018 / 15:39
1
answer

Application of algorithms in OOP

The algorithm / programming logic is focused on structured programming. How would you apply the algorithm to OOP?     
asked by 08.11.2017 / 16:24
2
answers

Why is this code not generating the average correctly?

#include <stdio.h> #include <stdlib.h> float media(int n, float* v){ int i; float s; s = 0; for(i=0;i<n;i++){ s += v[i]; return s/n;} } float variancia(int n, float* v, float m){ int i; float s; for(i=0; i<n; i++){ s +=...
asked by 13.05.2017 / 01:16
2
answers

Problems with extensive algorithm [closed]

I do not know what to do, I think I've made some mistake that I do not know. In my program the user must think of a number, and the computer should try to guess what number the user thought. The computer may ask the user for a few times wheth...
asked by 14.01.2017 / 22:11
1
answer

doubt Array.push () Javascript

Hello! Can anyone tell me why the push method is only saving the last item in the newArr array? My goal is to extract an array with the permutation of the passed values and in console.log() it comes out right, but when I try to th...
asked by 02.02.2017 / 19:04
1
answer

Subtract from a number the values to your right in a list

I have a situation that is as follows: Given an array with for example 5 positions [5, 10, 8, 2, 7] I need an algorithm that will allow me to do the following: Get 5 and subtract by the numbers that are after your position [1...
asked by 24.05.2017 / 14:03
1
answer

How to resume all students with common names

I am developing a program that has to manage a canteen of a school and on the menu I have an option to search for student by number and another to search for all students who have the first name in common. Here is my code, where I can not see my...
asked by 25.12.2014 / 00:38