Programming Ability Test Study 07-0. Write this number (20)

Source: Internet
Author: User

07-0. Write this number (20) time limit of MS memory limit 65536 KB code length limit 8000 B award Program StandardAuthor Chen, Yue

Read in a natural number n, calculate the sum of their numbers, and write each digit in Hanyu Pinyin.

input Format: each test input contains 1 test cases, which gives the value of the natural number N. This guarantees that n is less than 10100.

output format: output n in one line each digit of the sum of the number of digits, there are 1 spaces between the phonetic numerals, but there is no space after the last phonetic number in a row.

Input Sample:
1234567890987654321123456789
Sample output:
Yi San Wu
Submit code #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main ()
{
Char ig[101];
memset (ig,0,sizeof (IG));
Gets (IG);
int n=0;
for (int i=0;i<strlen (IG); i++)
{
int temp=ig[i]-' 0 ';
N+=temp;
}

int lgd[101];
int i=0;
while (n/10!=0)
{
lgd[i]=n%10;
printf ("%d", lgd[i]);
N=N/10;
i++;
}
Lgd[i]=n;
int n;
Char skt[101];
memset (skt,0,sizeof (Skt));
for (int j=i;j>=0;j--)
{
N=LGD[J];
Switch (n)
{
Case 0:
strcat (Skt, "Ling");
Case 1:
strcat (Skt, "Yi");
Case 2:
strcat (Skt, "er");
Case 3:
strcat (Skt, "San");
Case 4:
strcat (Skt, "Si");
Case 5:
strcat (Skt, "WU");
Case 6:
strcat (Skt, "Liu");
Case 7:
strcat (Skt, "Qi");
Case 8:
strcat (Skt, "ba");
Case 9:
strcat (Skt, "JIU");
Default
Break
}
}
for (int j=0;j<strlen (SKT) -1;j++)
printf ("%c", Skt[j]);
printf ("\ n");
printf ("%d", lgd[i]);
return 0;
}

Programming Ability Test Study 07-0. Write this number (20)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.