View Code of Problem 101

    #include<stdio.h>
    #include<string.h>
    int main()
	{
    	char a[100],b[100];
		int j=0,k=1,l,i;
    	while(scanf("%s",a)!=EOF)
		{
			j=0;
			k=1;
    		l=strlen(a);
    		for(i=l-1;i>=0;i--)
			{
    			if(a[i]!=',')
				{
    				b[j]=a[i];
    				if(k%3==0&&i!=0)
					{
    					b[++j]=',';
    				}
    				j++;
    				k++;
    			}
    		}
    		for(i=j-1;i>=0;i--)
			{
    			printf("%c",b[i]);
    		}
    		printf("\n");
    	}
    }

Double click to view unformatted code.


Back to problem 101