当前位置:网站首页>Write this number in C
Write this number in C
2022-06-30 01:31:00 【Martin の Blog】

Algorithm design ideas
- Define a list of numbers and letters
- Use get Method to read a string , And add a single character to a number to get the value n
- Traverse n value , take n Keep the number of digits in the list t in
- Through the list t Print the alphanumeric list with the values in
Code
#include <stdio.h>
#include <string.h>
int main(){
char c [105];
int a [5];
char pinyin[][9] = {
"ling", "yi", "er", "san", "si", "wu", "liu", "qi", "ba", "jiu"};
int i, n, t;
n = 0;
t = 0;
gets(c);
for(i=0; i<strlen(c); i++){
n += c[i] - '0';
}
while(n != 0){
a[t] = n % 10;
n = n / 10;
t++;
}
printf("%s", pinyin[a[t-1]]);
for(i=t-2; i>=0; i--){
printf(" %s", pinyin[a[i]]);
}
return 0;
}
Running results

边栏推荐
- Is the course of digging money reliable and safe to open an account?
- js逆向请求参数加密:
- MySQL monitoring 6
- 【535. TinyURL 的加密与解密】
- Varnish 基础概览3
- MySQL function
- Kwai reached out to the "supply side" to find the "source" of live broadcast e-commerce?
- 【二叉树】最大二叉树 II
- Precautions for postoperative fundus hemorrhage / / must see every day
- Mechanical --nx2007 (UG) -- gap analysis (interference inspection)
猜你喜欢

Pytroch Learning Notes 6: NN network layer convolution layer

Application features and functions of painting Aquarium

Statsmodels notes STL

R language linear regression model fitting diagnosis outliers analysis of domestic gas consumption and calorie examples with self-test questions

The first technology podcast month will begin soon

Some thoughts on small program subcontracting and verification of uiniapp subcontracting optimization logic

Embedded exit (review and release)

js返回内容被unicode编码

Chiffrement des cookies 8

TP-LINK configure WiFi authentication method for wireless Internet SMS
随机推荐
JS prototype and prototype chain (Lantern Festival meal)
C语言 数组元素循环右移问题
Interface Association of postman
Rubymine development tool, refactoring and intention operation
The 8th "Internet +" competition - cloud native track invites you to challenge
Machinery -- nx2007 (UG) finite element analysis tutorial 2 -- assembly
Sentinel source code analysis Chapter 9 - core process - lookprocesschain finding resource processing chain
【机器学习Q&A】余弦相似度、余弦距离、欧式距离以及机器学习中距离的含义
Ansible ad-hoc 临时命令
Kwai reached out to the "supply side" to find the "source" of live broadcast e-commerce?
Ansible ad-hoc temporary command
[MRCTF2020]Ezpop-1|php序列化
Ctfshow competition original title 680-695
城市规划馆在设计制作上需要注意什么
Quality management of functional modules of MES management system
[binary tree] maximum binary tree II
Sentinel source code analysis Part 6 - sentinel adapter module Chapter 4 zuul2 gateway
Interview summary
Mysql 监控1
JS anti shake and throttling