long int does not work.. but it was required anyways.
plese suggest the problem with the code.
Search found 3 matches
- Sat Apr 23, 2011 12:29 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 319010
- Sat Apr 23, 2011 12:28 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 319010
Re: Run time error in ANSI C - Problem ID 100
It seems i am taking integer as an input though it should be "long int" . I will try with long int. Hope it works.
- Sat Apr 23, 2011 12:17 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 319010
Run time error in ANSI C - Problem ID 100
I am getting Run time error with this piece of code in ANSI C. Please help
int main()
{
int a,b,result;
do
{
scanf("%d",&a);
scanf("%d",&b);
if(feof(stdin))
break;
else
if(a>b)
result = count_max_cycle(b,a);
else
result = count_max_cycle(a,b);
printf("%d %d %d",a,b,result);
}
while ...
int main()
{
int a,b,result;
do
{
scanf("%d",&a);
scanf("%d",&b);
if(feof(stdin))
break;
else
if(a>b)
result = count_max_cycle(b,a);
else
result = count_max_cycle(a,b);
printf("%d %d %d",a,b,result);
}
while ...