Questions tagged as 'algoritmo'

3
answers

How to sum all the numbers in the while sequence?

How to add from 1 to 64 in while ? I wanted to make the sum 1+2+3+4+...+64 print the value of the sum by the end. What I've tried so far: #include <stdlib.h> #include <stdio.h> int main(void) { int numero= 1...
asked by 15.02.2018 / 16:43
3
answers

Sort a string array in Swift using a function

I need help to solve the following programming logic problem in Swift. The task is to organize the array below in descending order using a function. Description: You must implement an algorithm that receives a list of strings with specific...
asked by 04.05.2018 / 15:02
3
answers

Algorithm for verifying digit calculation

   Create an algorithm to request a five digit code (COD), and generate the checker digit (DIGV) module 7 for that code.      Assuming that the five digits of the code are ABCDE, a way of calculating the desired digit with modulus of 7 is: S...
asked by 28.03.2016 / 19:18
2
answers

Find the largest palindrome made from the product of two 3-digit numbers - Python

I have a problem. I'm creating an algorithm in Python to find the largest palindrome made from the product of two 3-digit numbers. Code: i = 0 while i <= 999: temp = str(i * 999) tempInverso = temp[::-1] if temp == tempInvers...
asked by 02.08.2017 / 22:19
2
answers

Get first item from each object in a JSON response

I'm getting a json through the following URL: link (via GET) I'm iterating over objects, but I wanted to get only the first item of each object, which in this case would be URL. How do I do this? axios.get("http://jsonplaceholder.t...
asked by 24.12.2018 / 22:25
3
answers

How to validate and calculate the control digit of a CPF

How does the algorithm that calculates the digit of a CPF (Brazilian Physical Register) work? And how is this calculation used to validate the CPF? If possible, I would like examples in Python.     
asked by 19.05.2015 / 01:57
2
answers

Password Validator in C [closed]

I'm trying to solve the problem 2253 - Password Validator , but it is giving 10% wrong answer, but all my tests are working, can anyone find the error? #include <stdio.h> #include <string.h> #include <ctype.h> int validade(c...
asked by 24.09.2017 / 03:08
2
answers

PHP algorithm 1,2,3,4 = 1 + 2, 2 + 3, 3 + 4

For example, I have this array: $Ids = array(1, 2, 3, 4); Below is the result I would like to get: $Pair [0] = 1 + 2; $Pair [1] = 2 + 3; $Pair [2] = 3 + 4;     
asked by 22.05.2017 / 01:32
1
answer

How to merge an array?

I'm writing a program that merges the values of two arrays, with the same amount of values. The program receives as input the amount of values in each array. It then receives the values and, finally, prints the merged values, as follows: Entr...
asked by 10.04.2016 / 14:24
4
answers

How to add entries in a dictionary?

How do I add entries provided by a user in a dictionary? For example: Entry: 1 abcde 2 adecd 3 aaabb The created dictionary would be: dicionario = {'abcde' : 1, 'adecd' : 2, 'aaabb' : 3} or dicionario = {1 : 'abcde', 2 : 'adecd',...
asked by 17.04.2016 / 14:33