Posts by Edi Junior • 21 points
5 posts
-
0
votes1
answer144
viewsA: Possible error in the logging of a function that returns whether an integer is an Armstrong number
The program was working for some, it also worked on an online compiler for me, but in the end I did a function to calculate the power. I just added this function and swapped Pow for calc_pow in the…
canswered Edi Junior 21 -
-1
votes1
answer144
viewsQ: Possible error in the logging of a function that returns whether an integer is an Armstrong number
Armstrong numbers are numbers that are the sum of their own digits, each raised to the number of digits. Ex: 371 (3 digits) = 3³ + 7³ + 1³. Knowing this, my algorithm gives error with the number 153…
casked Edi Junior 21 -
0
votes0
answers34
viewsQ: Problem: I have two strings, if I fill all the positions of the first string, it concatenates with the value of the second string
A simple algorithm to compare two cpfs: #include <stdio.h> #include <stdlib.h> #include <conio.h> #include <string.h> int main(){ char cpf[11], cpfBusca[11]; for(int i = 0; i…
-
1
votes0
answers159
viewsQ: Expression "n % 2 ? ..." should not be "n % 2 == 1 ? ..."
Hello, I did an exercise in codewars and a solution caught my attention: function padIt(str, n) { while (n > 0) { str = n-- % 2 ? '*' + str : str + '*'; } return str; } I wonder, what exactly the…
javascriptasked Edi Junior 21 -
1
votes1
answer54
viewsQ: At the last run of the repeat loop the entered value is assigned to my counter
I put a printf() to track what happened and everything was normal, until I type my last value and it is assigned to the counter quantN. The conditional even works when it is a negative value, it…