3

整数的逆序_c语言的技术博客_51CTO博客

 1 year ago
source link: https://blog.51cto.com/u_15652430/5723629
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

整数的逆序

精选 原创

Zcccccc6 2022-09-29 17:40:32 博主文章分类:c练习 ©著作权

文章标签 赋值 文章分类 C/C++ 编程语言 阅读数185

思路:首先定义三个变量abc,让用户输入一个整数存放在变量a中

          然后让a对10取余数得到其个位数,将这个个位数赋值给b

          每次的a/10使得a每次丢到其各位,得到一个新的整数,循环第二三步

整数的逆序_赋值

c=c*10+b的作用:每次循环使得上次循环的位数大10倍

整数的逆序_赋值_02
  • 收藏
  • 评论
  • 分享
  • 举报

上一篇:循环语句


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK