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
-
-1
votes1
answer127
viewsHow to read String in the best way to use it as a halting condition of a loop?
I’m trying to ask for input to a string and read it as a halting condition of a loop but I’m not getting it. Logic Error. #include <stdio.h> #include <locale.h> #include…
-
-1
votes1
answer80
viewsLogic problem - React does not calculate
I’m starting with React now, and I had an exercise to do, the exercise consists of "draw out" multiples of 5 from an ATM, but I forgot something in the code, because when I click to calculate, just…
-
-1
votes2
answers292
viewsBasic - Java: error: class, interface, or Enum expected
I am learning POO by Java and this would be my first code, outside the classic hello world kkk. How long to compile it via bash, the following error appears: class2.java:12: error: class, interface,…
-
-1
votes1
answer32
viewsDiagonal Difference Hacker Rank Kotlin My solution approves in some but fails in the rest
fun diagonalDifference(arr: Array<Array<Int>>): Int { var tamanho = arr.size - 1 var i = 0 var diagonal1 = 0 var diagonal2 = 0 for(i in 0 .. tamanho){ diagonal1 += arr[i][i] diagonal2 +=…
-
-1
votes1
answer51
viewsExplain to a beginner the query "if(! found)" in the code
I have an exercise that searches a number on a predetermined vector; and answers "was found and which vector position" or answers that "the number is not in the vector". I wanted the explanation of…
-
-1
votes1
answer35
viewsPrepare a program to request 10 numbers. You must display the amount of negative, positive and zeros typed
I am trying to create a program in C which asks for 10 numbers. You must display the amount of negative, positive and typed zeros. I’ve tried it here but it’s not working. Reading from scratch is…
-
-1
votes1
answer29
viewsOutput in percentage by taking into account user inputs
The program asks the sex of the user, then I asked for the opinion about a certain product( yes or no). As a way out, he should give me the total of people who gave yes and no, then the percentage…
-
-1
votes2
answers48
viewsQuestion in reading and printing names with char
Eai guys. I’m trying to create a code that reads, stores and prints names up to 5 letters(Characters). I’m sure there must be a more agile way than the one I made, just below: OBS: I want to be able…
-
-1
votes0
answers10
viewsHelp with possible Batch Script Logic Error
Friends, good morning! Could you help me with the batch script below? I think I have some logic error, because it goes into an infinite loop and never closes. In summary the script is programmed by…
logicasked 3 years, 2 months ago Carlos R. Oliveira 1 -
-2
votes3
answers254
viewsLogic to compare four values and find the smallest
It is correct to compare 4 values in this way? Se (A < B && A < C && A < D){ Escreva A; }; Senao Se (B < A && B < C && B < D){ Escreva B; }; Senao…
-
-2
votes1
answer311
viewsCalculate difference in days between two dates excluding weekends
I would like to know how to calculate the difference in days between two dates, excluding Saturday and Sunday. I have a field in my form where picks the date acts, and another where the user selects…
-
-2
votes1
answer712
viewsFunction passing
Run a function called passWhy you print on the console "here I have the value of x" where x will be the value of i in each iteration, for each value from 0 to 3. Only it gives this error message:…
-
-2
votes1
answer64
viewsGenerate match matches per round
I’m managing to generate matches and display on the screen. But it happens that a same ski can not play in the same round. I created a function verificarRodada() to avoid this, but she doesn’t seem…
-
-2
votes1
answer128
viewsHow do I use the Python range function in this specific case?
I have a problem and I’m looking for the best way to solve it. I have a function that inserts in an array 26 positions starting from the letter 'to' down to the last letter of the alphabet which is…
-
-2
votes1
answer563
viewscalculate distance between two points in php
I am doing a project and I need to calculate the distance in kilometers(KM) using the latitude and longitude I found a function in php but when I will take the result and compare with the google it…
-
-2
votes1
answer35
viewsjavascript does not recognize the array possible when I set
I am making a project in Ionic 3 however when weighed for it shows a specific place of the array it does not recognize and undefine my code: public status: boolean = null; public id_est = null;…
-
-2
votes1
answer46
viewsCan anyone help me understand this line of javasript code?
This algorithm is implemented in a book project Use your head! Javascript Programming, of chapter 8 created a naval battle. Where I couldn’t understand this piece of code. if(hit &&…
-
-2
votes1
answer26
viewsThe program just gives me back the list again, without me being able to enter the values, what am I doing wrong?
#include <stdio.h> main() { float saldo, valor; int opc; printf("Entre com o saldo inicial da conta: "); scanf("%f", &saldo); while (opc != 4) { printf("\nBem vindo ao banco.\n");…
-
-3
votes1
answer62
viewsJava "per unit" logic
How can it be a method to return the following: Knowing that 220 is equivalent to 0.3275 and that with each addition of 0.0049 in the value of 0.3275, it will increase in one unit the 220, or with…
-
-3
votes1
answer286
viewsHow to increment and decrease using FOR?
I’m not getting to increment the variable with each click on one button. Example: a Button and a Paragraph, every click on button, increase the value in Paragraph, example, from 0 to 1, and each…
-
-3
votes4
answers109
viewsDefine the lowest and highest value among three numbers
I’m trying to create a program in c# using windows Forms where it gets 3 numbers and tells me which is the biggest and which is the smallest, but I’m really very beginner and I don’t think where…
-
-4
votes4
answers224
viewsMy program made in C++ is in infinite loop, how to fix?
My program skips right to the end. Doesn’t even enter to read. Follows code: #include <iostream> int main(void) { int i= 0; string nome; for(i=0;i>=10;++i) { cin>>nome;…
-
-4
votes2
answers96
viewsWhat is the mistake in logic?
Given the values of x real and n natural positive, calculate: #include <stdio.h> int main(){ float x = 0.0; int n = 0; int soma = 0; int fat = 1; printf("Digite um valor:"); scanf("%f",…
-
-5
votes1
answer1367
viewsHow to elaborate an algorithm that writes the odd numbers between 100 and 200?
I’m stuck on this question I saw in a PDF of programming logic, how can I fix this? Develop an algorithm that generates and writes the odd numbers of the numbers read between 100 and 200.…
-
-5
votes2
answers72
viewsWhy does "0" not appear? Once the logic of "do while" is: do yourself then check
If you literally analyze the loop do while, makes perfect sense since something is done while this is true, but pragmatically has no logic. For example, in the code below, when we arrive at the…
-
-7
votes1
answer42
viewsPYTHON LOGIC/FRACTION ERROR(HOW TO SOLVE)
In this market box code, if you type 0 in the variable Pv there will be an error in the last print in the variable Vp/Pv, because there is no way to caucular a number x divided by zero, how do I…