y run time error ?

#include <stdio.h>
int a;
void main(){

while(1){
scanf("%d",&a);
if(a>=100||a==42){
printf("%d",a);
return ;
}

printf("%d",a);
 
}
 
}

Because main() function must return some value. Modify it to int main() and return 0; this way:

 #include <stdio.h>
int a;
int main(){
while(1){
scanf("%d",&a);
if(a>=100||a==42){
printf("%d",a);
return 0;
}

printf("%d\n",a);  //Note as per the question you need to put '\n' here which you forgot.

}
return 0;
}