Search found 2 matches

by sajib amin
Sun Oct 05, 2003 6:26 am
Forum: Volume 3 (300-399)
Topic: 332 - Rational Numbers from Repeating Fractions
Replies: 83
Views: 34233

332-Why RTE

I got RTE for the following code:


#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

long gcd(long a,long b)
{
if(b == 0) return a;
else return gcd(b,a%b);
}

main()
{
long n,m,ln;
long deno,nume,g,kase=0;
char a[100],b[100];

while(scanf("%ld",&m) && m != -1 ...
by sajib amin
Sun Oct 05, 2003 6:00 am
Forum: Volume 2 (200-299)
Topic: 275 - Expanding Fractions
Replies: 47
Views: 26819

275-Why get WA

I got WA for the following code:

#include<stdio.h>

void main()
{
int a,b,rem,quot,quo[40000],arem[40000];
int i,j,length,flag,start,total,fstln;

while(scanf("%d%d",&a,&b)==2 && a && b)
{
quot = a / b;
rem = a % b;
quo[0] = '.';

flag = 0;
for(i=1;;i++)
{
arem[i] = rem;
rem = rem ...

Go to advanced search