The following program should take 4 numbers but it takes 5 numbers and prints first 4 number entered. How to correct the problem???
#include<stdio.h>
#include<conio.h>
void main()
{
int a1,a2,a3,a4;
printf("Enter 4 numbers \n");
scanf_s("%d %d %d %d ", &a1,&a2, &a3, &a4);
printf("The 4 numbers entered are %d %d %d and %d",a1,a2, a3, a4);
_getch();
}
Output
Enter 4 numbers
6
7
8
9
1
The four numbers entered are 6 7 8 and 9