View Code of Problem 101

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<ctype.h>
int main()
{
	char a[100];
	while(gets(a)!=NULL)
	{
		char b[100]={'\0'},c[100]={'\0'};
		int k=0,i,t=0;
		for(i=strlen(a)-1;i>=0;i--)
		{
			if(isdigit(a[i]))
			b[k++]=a[i];
		}
		for(i=0;i<k;i++)
		{
			c[t++]=b[i];
			if(i%3==2)
			c[t++]=',';
		}
		for(i=t-1;i>=0;i--)
		{
			printf("%c",c[i]);
		}
		printf("\n");
	}
	return 0;
 } 

Double click to view unformatted code.


Back to problem 101