I am a self learner, and I was going through a free class online. I am trying to put the values of the everyOther into an array, so I can access it to later. I have looked around the internet, but am not able to find anything resourceful. Can you show me how to store the output values of everyOther in to an array. Thanks in advance.
#include <cs50.h>
#include <stdio.h>
#include <math.h>
long countDigit(long long n);
int main(void)
{
long n;
//This is asking for the input
do
{
n = get_long("Number: ");
}
while(!(countDigit(n)>13));
//Checksum math
long everyOther = 0;
while(n > 0)
{
long lastNumber = n/10;
everyOther = lastNumber % 10;
n = n / 100;
printf("%li\n", everyOther);
}
}
//This function helps us with the counting of the number
long countDigit(long long n) {
return floor(log10(n) + 1);
}