Friday, September 23, 2016

UVA 10101 - Bangla Numbers Solution

Unknown
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    long long int tc=0,n;
    while (scanf("%lld",&n)!=EOF)
    {
        printf("%4lld.",++tc);
        if (n==0){ printf(" 0\n"); continue;}
        int a[20]={0},i=14;
        while (n) { a[i--]=n%10; n/=10; }
        //printf("%d\n",i);
        int b=a[0];
        if (b) printf(" %d kuti",b);
        b=a[1]*10+a[2];
        if (b) printf(" %d lakh",b);
        b=a[3]*10+a[4];
        if (b) printf(" %d hajar",b);
        b=a[5];
        if (b) printf(" %d shata",b);
        b=a[6]*10+a[7];
        if (b) printf(" %d",b);
        if (i<7) printf(" kuti");
        b=a[8]*10+a[9];
        if (b) printf(" %d lakh",b);
        b=a[10]*10+a[11];
        if (b) printf(" %d hajar",b);
        b=a[12];
        if (b) printf(" %d shata",b);
        b=a[13]*10+a[14];
        if (b) printf(" %d",b);
        printf("\n");

    }
     return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,