I had something like this in mind but I don’t know how to implement it.
As i’m a beginner (on the CS50 course), i don’t really understand other answers I have came upon.
Thanks for your help!
for (int i = 1; i < 16; i++)
{
int Ai= number % (10 * i);
}
>Solution :
No, you cannot do this, but you can create an array and append the values to the array. For example:
#include <stdio.h>
int A[16];
for (int i = 1; i < 15; i++)
{
//The reason for using i-1 as the index of the array is that i starts as 1, not 0 (array indices start at 0).
A[i - 1] = number % (10 * i);
}
//The code below only prints the array.
for (int i = 0; i < 16; i += 1){
printf("A%d: %d\n", i+1, arr[i]);
}