I know that runtime error occurs when program consumes large memory or divide by 0 somewhere. this is the code which prints all the numbers until user types 42.(does not print 42).
#include<stdio.h>
int main()
{
int n;
while(1)
{
scanf("%d",&n);
if(n==42)
break;
else
printf("%d",n);
}
}
please tell me why am I getting runtime error in such a simple code?