0

I'm still a little confused. Basically this is what I'm trying to do, and I'm having one hell of a time with it...

My program has two values "Value" and "N". The goal of the program is to select every Nth number of Value starting with the last, and print it out. For example...

VALUE--N------ RESULT

12345, 1 select **1 2 3 4 5**

12345, 2 select **1** 2 **3** 4 **5**

12345, 3 select 1 **2** 3 4 **5**

12345, 4 select **1** 2 3 4 **5**

12345, 5 select 1 2 3 4 **5**

So far I got my code to store every number of Value into separate elements of an array. But I'm having the hardest time getting the Nth number of value to print out in a concatenation.

```
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdbool.h>
#include <math.h>
uint64_t everyNth(uint64_t Value, uint8_t N)
{
int numDigits(int num)
{
int length = 0;
while(num >= 10)
{
num = num/10;
length++;
}
length++;
return length;
}
int numLength = numDigits(Value);
int array[numLength];
int i;
int lastDigit;
int minusLast;
for(i=0;i<numLength;i++)
{
lastDigit = Value % 10;
array[i] = lastDigit;
minusLast = Value - lastDigit;
Value = minusLast / 10;
}
int first = array[0];
return secArray[0];
}
int main()
{
uint64_t Value = 12345;
uint8_t N = 1;
uint64_t Result = everyNth(Value,N);
printf("%21"PRIu64"%3"PRIu8"%21"PRIu64"\n", Value, N, Result);
return 0;
}
```