In the following simple program after the user inputs an integer the command line remains a flashing prompt. When I exit the program the answer is then printed out. Why is this and how can I fix it?
//powers of 2
printf("What power of 2?\n");
for (i=0; i<a;i++)
printf("the answer is: %i\n",b);
Try remove the \n in your scan :
scanf. After that I compiled your program and it worked properly.