gubbaraviteja
Right off the assembly line
Hello guyz,
I'm ravi and BTW in an attempt to solve a problem I encountered with the following error.
The problem is as follows:
Your program is to use the brute-force approach in order to find the Answer to Life, the Universe, and Everything. More precisely... 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 to solve the above problem is as follows:
<code>
#include <stdio.h>
void main()
{
int n,flag=0;
do
{
scanf("%d",&n);
if(n==42) flag=1;
}while(flag==0);
}
</code>
But the judge says there is a runtime error..
can any one tell me where the error is??
but it perfectly executing in my command prompt with GCC compiler.
Please help me asap.
I'm ravi and BTW in an attempt to solve a problem I encountered with the following error.
The problem is as follows:
Your program is to use the brute-force approach in order to find the Answer to Life, the Universe, and Everything. More precisely... 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 to solve the above problem is as follows:
<code>
#include <stdio.h>
void main()
{
int n,flag=0;
do
{
scanf("%d",&n);
if(n==42) flag=1;
}while(flag==0);
}
</code>
But the judge says there is a runtime error..
can any one tell me where the error is??
but it perfectly executing in my command prompt with GCC compiler.
Please help me asap.