Posts by Igor • 51 points
4 posts
-
0
votes2
answers76
viewsA: What is wrong with the logic of this code that sums bands of numbers?
#include <stdio.h> int main() { int a, b, soma=0, i; printf("Digite a: "); scanf("%d", &a); printf("Digite b: "); scanf("%d", &b); for(i=0; i<=b; i++) { if(i >= a) { soma = soma…
-
0
votes2
answers46
viewsA: Convert character
char converte_minusculo (char *s[30]) { int posicao = 0; while (s[posicao] != '\0') { if(s[posicao] >= 65 && s[posicao] <= 90) { s[posicao] + 32; } posicao++; } return s; }…
-
0
votes2
answers47
viewsA: How to stop receiving keystrokes?
Really this kind of confusing, it would be nice if Voce put the rules of the game. I suggest you try to do something about it: while(acertos != x) //enquanto o usuario nao acertar todos os numeros o…
-
5
votes11
answers37801
viewsA: Compute sum of digits of a number
My solution similar to yours: x = int(input("Numero: ")) soma = 0 while (x != 0): resto = x % 10 x = (x - resto)//10 soma = soma + resto print(soma)