Where is the mistake? Why numbers are not written to the array and not displayed later?
#include <iostream> using namespace std; int main() { int k = 0, ch, a; int array[123]; cin >> ch; while (ch > 0) { a = ch % 10; ch = ch / 10; array[k++] = a; } cout << array[k]; system("PAUSE"); return 0; }