rewrite small numbers from input to output. Stop processing input after reading in the number 42. All numbers at input are integers of one or two digits.
Example
Input:
1
2
88
42
99
Output:
1
2
88
My code:
#include <stdio.h>
int main(void)
{
int x;
int a[100];
int i;
for (i=0; i<5; i++)
{
scanf("%d", &a[i]);
}
printf("\n\n");
for (i=0; i<x; i++)
{
if (a[i]!=42)
{printf("%d", a[i]); printf("\n");}
else goto hey;
} hey:
printf("\n");
return 0;
}
Please tell why this code is not getting accepted?