Most voted "logic" questions
Use this tag when the question primarily involves logical sense in the development or processing of an information-based application that, related to each other, imply an objective within an established rule.
Learn more…376 questions
Sort by count of
-
2
votes2
answers123
viewsHave a loop run again
Code: while (digita != 4){ System.out.println("Digite o o número referente ao tamanho da(s) pulseira(s)\n1.Pequena (17cm) - R$180,00\n2.Média (18cm) - R$200,00\n3.Grande (20cm) -…
-
2
votes1
answer396
viewsLogic error in PHP when constructing if elseif Else
I have a simple email form with reCaptcha. To avoid the user sending the email and keep giving F5 and sending the same email several times, I did a redirect in a php script. But there is a logic…
-
2
votes1
answer623
viewsDecomposition into primes
Hello folks I’m learning C++ for Data Structure subject and there is some error in the code that is creating an infinite loop. #include <stdio.h> int fatores(int a[], int n, int *x) { int…
-
2
votes1
answer226
viewsHow to use more than one programming language in the backend?
I would like a detailed (or simple, if easy to understand) explanation of how companies use more than one programming language in the backend. How communication between languages is established? For…
logicasked 8 years ago Douglas Rodrigues 23 -
2
votes1
answer405
viewsWhat is a balanced tree and what are the advantages of using it?
Well the question is basically this, what is a balanced tree? What differs it from a normal tree, and what are the advantages of using it? A brief description and a use of it is already very…
-
2
votes1
answer729
viewsI can’t change the value of variables inside a loop
I’m trying to solve the following exercise: Develop a program to check the student’s grade in a test with 10 questions, the program should ask the student the answer of each question and finally…
-
2
votes2
answers452
viewsLogic PHP: how to build this looping (for, while, foreach)?
Good night. I am in the following situation: I am reading an XLS and playing in table. This XLS has 52 rows and 6 columns. What I’m picking up to do is: $result[linha 1][coluna A] $result[linha…
-
2
votes1
answer90
views(SQL) Add "Count 0" when no record
Hello, I’m picking up for a query in the database where I need to pick up how many subscribers have registered in a tournament, the problem is that I need to also bring the tournaments that do not…
-
2
votes2
answers368
viewsIs the calculation of RENAVAN correct? Can you improve something?
Hello, I am searching on the internet and found on that website a code in C# of how to calculate RENAVAM, I moved a little, but I can’t find anywhere that explains how RENAVAM calculus actually…
-
2
votes2
answers108
viewsformulario this with problem when recovering the Post value
hello I’m making a website and I wanted so the person type the link javascript pick up and send the form but it is sending but when I try to recover with the $_POST it n recovers the value q was…
-
2
votes1
answer158
viewsIs it possible to put an OR in the FOR stop condition?
It is possible to put two conditions to stop one for? In my example I’m trying to do this: function criacaoParidade(entrada) { entrada = Array.from(entrada); func = positionBit(entrada); tam =…
-
2
votes2
answers203
viewsExplanation of recursive functioning
I’m at the beginning of system analysis studies and I’m learning programming language. In C language studies I started to see recursiveness and some codes that have recursiveness I get lost and end…
-
2
votes2
answers123
viewsI have a logic problem to filter the registration and editing of my consultation schedule
I am Using the Schedule component of Primefaces(6.2) My project uses: Postgres, Hibernate, JSF. With the code this way I can register a new schedule and I can’t add a new schedule for the same…
-
2
votes2
answers312
viewsAsterisk tree algorithm *
I have a problem in an activity, the activity would be to make an asterisk tree of the type: * *** ***** but with my code for (int i = 0; i <= 5 ; i++) { for (int j = 0; j <= i; j++) {…
-
2
votes5
answers835
viewsHow to put the operation (sum, multiplication) within a variable
Good morning! I am studying programming logic with JS and would like to know how to ask the user to type the operation, so the JS interprets this and generates the result... <script> var n1 =…
-
2
votes1
answer1093
viewsDifficulty in developing a little game
I’m implementing a game, against the computer, that follows this format: Be N the initial part number and M the maximum number of pieces that is possible withdraw in a round. To ensure that the…
-
2
votes3
answers378
views -
2
votes4
answers258
viewsHow is this operator not working in this code?
Code: var i = 0, finished = false; while( (i < acentos.length) && !finished){ Question: I have a variable bool receiving false, and in my while I am denying her. If I’m denying a false…
javascript operators logic boolean logical-operatorasked 7 years, 6 months ago Nicolas Guilherme Matheus 502 -
2
votes2
answers153
viewsNext 0-Z Sequence Code with Javascript
I need to create a Javascript function that takes a string of letters and numbers and it returns the next count value. The count goes from 0 to Z. Example of the sequence: 0 - 1 - 2 - 3 - 4 - 5 - 6…
-
2
votes1
answer506
viewsWhen to use And, Andalso and Or, Orelse?
I don’t know when to use the syntax Or or OrElse and/or And or AndAlso, because I don’t understand what difference it makes in the logic circuit. Being in C#, And = &, AndAlso = && and…
-
2
votes1
answer3275
viewsCheck if the input is an integer
I need a function that reads a keyboard input and validates whether it is an integer (negative or positive). If it is, it should return the value. Otherwise, it should report that the entry is…
-
2
votes1
answer269
viewsCustom String Ordering
Hello, I have a problem, I need to sort a set of letters in alphabetical order, but the word order is customized from a specific order of letters. <?php // Pega o conteudo do arquivo texto.…
-
2
votes1
answer91
viewsDecision structure, how to know which to use?
On good logic practice: I have a Dropdownlist with 8 values and depending on what is selected will add/remove components from a page html, where it is manipulated via jQuery Now my question is, what…
-
2
votes1
answer854
viewsSelect from time to time
I’m trying to ride a sql to check if there is any record between times informed but not leaving, I did some tests but unsuccessfully. For example, a bank record containing these two times, as…
-
2
votes1
answer186
viewsDo irreversible operations exist?
In mathematics (therefore in programming) there are mathematical operations (+,-,*,/). But all the mathematical operations I know are perfectly reversible, for example, by dividing a number, I could…
-
2
votes3
answers1428
views(SQL) In parentheses in the WHERE clause
Hello, I didn’t find much information in research I did on... but I am currently having a problem which is as follows: I have an appointment with many simple conditions, just sequences of and. But…
-
2
votes3
answers92
viewsInsert summary when there is a change in a PHP Array
to with a doubt that may be easy, but to broken the head, I have a table that is generated through an array, follows code below: foreach($grupo_arr $k => $v){ ?> <tr> <td><?php…
-
2
votes2
answers47
viewsProblem with SQL relational logic
Considering this scheme CREATE TABLE bra_ocorrencias ( estado varchar2(2), genero varchar2(1), ano number, nome varchar2(30), num_ocorrencia number ); I need to make a query that returns me the most…
-
2
votes1
answer40
viewsLooking for similar items when using an intermediation table?
Following some advice to optimize queries in Mysql, I decided to split a list of items into 3 tables: Table anime: +----------------+-------------+ | id | titulo | +----------------+-------------+ |…
-
2
votes2
answers134
viewsProgram completion condition in C!
I have a program in C where the output should be the average of the numbers typed and how many of these values were typed are larger than the average. the program receives up to 100 F values, where…
-
2
votes1
answer86
viewsGenerate String from list contents
I have a class called CoreFiltroSearch that has a list of ICoreFiltro calling for filtros. Follows the class and interface: public class CoreFiltroSearch { private List<ICoreFiltro> filtros =…
-
2
votes3
answers653
viewsWhen to use if or Else If?
It’s a pretty silly thing, but during my writing I came across the following question: When is it really necessary to use if's or else if's in my code? Is there any impact on performance? I will put…
-
2
votes1
answer62
viewsHow to display the highest number of decimals in javascript?
I was doing some experiments and I would like to calculate the 1,000 first decimal places of the Euler constant (as demonstrated on this website http://www.profcardy.com/cardicas/constantes.php),…
-
2
votes1
answer43
viewsVector error - Arrayindexoutofboundsexception error?
Guys I’m trying to solve this exercise Develop a program to receive the name of a student with their respective 2 grades, then calculate the student’s average and present at the end the calculated…
-
2
votes1
answer1653
viewsdoubts of logic in Python
I am a beginner in the world of programming and also in python. Solving some exercises I came across this Make a Program for a paint shop. The program should ask for the size in square meters of the…
-
2
votes1
answer50
viewsa function to generate a path through a point and segment map. ps: complicated, at least for me
Hello, I’m testing some ideas, doing some programs in python 3, and I need help with something complicated in which I don’t understand anything, nor can I come up with any viable solution. to…
-
2
votes2
answers86
viewsHow to deal cards from a deck using dictionary
I have the following dictionary composed of a list of its values: baralho = { 'Paus': ['Ás',2,3,4,5,6,7,8,9,10,'Dama','Valete','Reis'] , 'Ouros': ['Ás',2,3,4,5,6,7,8,9,10,'Dama','Valete','Reis'] ,…
-
1
votes1
answer364
viewsUse filter_input(FILTER_SANITIZE_NUMBER_INT) in an array with integer type entries
I have the following form: <form action="<?=PATH_ROOT?>professor/cadastrar" method="post"> Matrícula: <input type="text" name="matricula"> <br><br> Nome: <input…
-
1
votes0
answers108
viewsProblems generating JSON with JAVA
I’m having trouble generating this json { "receita": [{ "specialtys": [{ "date": "27/01/2016 00:00:00", "itemSpecialtys": [{ "specialtyId": 1, "specialtyName": "Tabelionato de Notas", "receitas": [{…
-
1
votes1
answer1032
viewsTest output value to check if it is INTEGER
I set the function below to check if the output value is integer or real. funcao menu_8():inteiro var logaritmo :real inicio para contador de 0 ate 12 faca logaritmo <- ((log(i[contador])) /…
-
1
votes1
answer214
viewsCannot find Symbol - variable calories
Why this mistake if I’m setting the calories on ifs? import java.util.Scanner; public class Alimentos { public static void main(String args[]){ Scanner in = new Scanner(System.in);…
-
1
votes1
answer165
viewsWorking with arrays, choosing only one data
I can have a composition of N elements in an array that can be arranged as follows for example: array with A, B, C and D... 12 possibilities. arr1 =…
-
1
votes2
answers8005
viewsWhat is the difference between the logical operators NOT, AND and OR?
I’m studying Boolean algebra and about logic gates, and I know that these logic operators and logic gates are used in digital systems, programming and electronics. The 3 main operators of Boolean…
-
1
votes2
answers740
viewsDoubt increment $i + loop for
Colleagues, sometimes I come across some snippets in the code used the variable $i before the repeat loop ($i = 0) and in the middle and end $i++, as the examples below: Ex1) $c = count($obj); $i =…
-
1
votes1
answer1190
viewsHow do I sync an offline database to an online one?
I have two identical databases, one offline and one online. In every field of a table I have a column called online with values 0 (did not send the data) or 1 (already sent the data). Usually I…
-
1
votes1
answer1665
viewsCreate truth table in C#
I have a test function that should receive different input combinations, to define these patterns I will use a truth table. However, I’m having difficulty generating the truth table, I made an…
-
1
votes2
answers28
viewsCSS Selector - Run a loop from a particular loop item
Good morning. Let’s say I have a table with 100 rows, the more I’d like my each (Jquery) to start from line 15. Which Css selector should I use? Or Jquery has some resource for this? Thanks to all…
-
1
votes1
answer2149
viewsAlgorithm problems for calculating NPV and IRR
I have a logic problem to calculate NPV and IRR. Formula for the NPV: Formula for the IRR: From these formulas I arrived at the following method: public double[] calcularVPLTIR () {…
-
1
votes0
answers101
viewsHelp with logic - Check if the order was made too far in advance
I’m developing a script in vba, in the Outlook, so that it saves all attachments that arrive with the new emails, with extension xlsx. It checks if it is the right attachment (through a code that…
-
1
votes0
answers172
viewsThe use of the triple exclamation mark (!!!)
Consider the following code: if (!!!window.customElements) { execPolyfill(); } What is the function of the 3 exclamation points before the expression window.customElements where only 1 would have…