Skip to content

Instantly share code, notes, and snippets.

@jcmpes
Created February 12, 2020 06:44
Show Gist options
  • Save jcmpes/23d21648c2b733b8ae21f463c64ea3d7 to your computer and use it in GitHub Desktop.
Save jcmpes/23d21648c2b733b8ae21f463c64ea3d7 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <cs50.h>
#include <math.h>
int main(void)
{
//prompt for input
long num = get_long("Number: ");
int n = floor(log10(num)) + 1;
int arr[n];
printf("%i\n", n);
//print my array elements
for (int i = 1; i < n; i++)
{
printf("%i \n", arr[n - i]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment