Why RE

General topic about Valladolid Online Judge

Moderator: Board moderators

Locked
ranacse05
New poster
Posts: 37
Joined: Wed Mar 28, 2007 5:08 pm
Location: Rajshahi
Contact:

Why RE

Post by ranacse05 »

Here is my code plz tell me where is the bug

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



int main()
{
int i,x,y,k;
char a[100];

while(gets(a))
{
char b[4]={0};
int ln=strlen(a);

for(k=0;k<ln;)
{
if(isdigit(a[k]))
{
{

if((a[k]-'0')<3)
{
b[1]=a[k];
b[0]=a[k+1];
b[2]=a[k-1];
}
else
{
b[1]=a[k];
b[0]=a[k+1];
}
k=k+2;
}
x=atoi(b);
printf("%c",x);

}

else
{
x=a[k];
for(i=0;;i++)
{
y=x%10;
printf("%d",y);
x=x/10;
if(x==0)
break;
}
k++;
}

}
printf("\n");
}
return 0;
}
I like to solve problems.

mmonish
Experienced poster
Posts: 109
Joined: Sun Mar 11, 2007 2:55 pm
Location: SUST

Post by mmonish »

U have to mention the prob number. Before creating a new thread search the board first.

Locked

Return to “General”