#include <stdio.h>
main()
{
char a[20];
char b[20];
char c[20];
int a_len;
int b_len;
int i;
printf ("please input string a: ");
scanf ("%s", a);
printf ("please input string b: ");
scanf ("%s", b);
a_len = strlen (a);
b_len = strlen (b);
for (i = 0; i < a_len; i++)
{
if (a[i] < '0' || a[i] > '9')
{
printf ("輸入數字串a有錯誤%s\n");
return;
}
}
memset (c, 0, sizeof (c));
sprintf (c, "%d\n", atol (a)+atol(b));
printf ("相加後的數字=%s\n", c);
}
字符串整數
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
An Overview of Reinforcement Learning
tangwing
2020-07-08 12:16:49
算法系列01----插入排序
zhengwei_cq
2022-07-27 13:26:21
算法設計與分析【2】分治算法
33 Audrey
2020-07-08 12:35:24
推薦系統系列:商品關聯分析
路越
2020-07-08 12:17:28
[NOTE in progress] Simulation Optimization
tangwing
2020-07-08 12:17:01
A Road Map for Deep Learning
點這個: https://towardsdatascience.com/a-road-map-for-deep-learning-b9aee0b2919f
tangwing
2020-07-08 12:17:01
Stochastic Optimization: Casual Notes
tangwing
2020-07-08 12:17:01
[NOTE in progress] Distributed Optimization and Statistical Learning via ADMM - Boyd
tangwing
2020-07-08 12:16:50
[NOTE in progress] ECE236C - Optimization Methods for Large-Scale Systems [on going]
tangwing
2020-07-08 12:16:49
【轉載】Overview of gradient descent algorithms
tangwing
2020-07-08 12:16:49
leetcode-112-路徑總和
叄贰壹
2020-07-08 12:04:52