Input a number from a user
The user can continue input a number until input ‘-1’
If -1 is entered, the program must show entered numbers
#include <stdio.h>
int main()
{
int arr[10000];
int n;
int i = 0;
while (true)
{
printf("Number ? ");
scanf("%d", &n);
arr[i++] = n;
if (n == -1) break;
}
i = 0;
while (arr[i] != -1)
printf("%d,", arr[i++]);
}