1
I make the sum of two numbers 5 and 5, how to pass the result (10) as follows:
vetor[0]=1 and vetor[1]=0, that is, separate the result for each position of my vector, without the vetor[0] receive the full amount that would be vetor[0]=10.
1
I make the sum of two numbers 5 and 5, how to pass the result (10) as follows:
vetor[0]=1 and vetor[1]=0, that is, separate the result for each position of my vector, without the vetor[0] receive the full amount that would be vetor[0]=10.
6
Dear,
Using successive division you can separate a decimal. There it is with you to keep each digit in the vector :-)
int numero = 520;
while (numero > 0) {
 int algarismo = numero % 10;
 // faça alguma coisa com o algarismo
 numero /= 10;
}
							Browser other questions tagged c array
You are not signed in. Login or sign up in order to post.
Possible duplicate of Separating integer by character
– Daniel