0

I am a programming beginner and wrote this code but during runtime, the first print command runs smoothly and scanf() also runs smoothly but after I provide the input, the rest of the code doesn't execute until I have to put another random character after that input. When I hit enter the command is executed. I don't understand why this is happening. Is it a glitch or does my code have flaws?

#include<stdio.h>
#include<conio.h>

int main()
{
    int n;
    printf("Enter Number \n");
    scanf("%d \n", &n);

    printf("Table of %d is \n",n);
    printf("---------------------- \n");

    printf("%d * 1 = %d \n",n,n * 1);
    printf("%d * 2 = %d \n",n,n * 2);
    printf("%d * 3 = %d \n",n,n * 3);
    printf("%d * 4 = %d \n",n,n * 4);
    printf("%d * 5 = %d \n",n,n * 5);
    printf("%d * 6 = %d \n",n,n * 6);
    printf("%d * 7 = %d \n",n,n * 7);
    printf("%d * 8 = %d \n",n,n * 8);
    printf("%d * 9 = %d \n",n,n * 9);
    printf("%d * 10 = %d \n",n,n * 10);

    return 0;
}
Jonathan Leffler
  • 698,132
  • 130
  • 858
  • 1,229

0 Answers0