zoukankan      html  css  js  c++  java
  • 不同位数数字取个十百千位数字的代码

    /* Note:Your choice is C IDE */
    #include "stdio.h"
    void main()
    { 
       //不同位数数字取个十百千位数字的代码
       int i,j,a;
       i = 78;
       j = 654;
       a = 4176;
       printf("-------两位数----------
    ");
       //获取个位的数字
       printf("%d个位的数字是	%d
    ",i,i%10);
       //获取十位的数字
       printf("%d十位的数字是	%d
    
    
    ",i,i/10);
       printf("-------三位数----------
    ");
       //获取个位的数字
       printf("%d个位的数字是	%d
    ",j,j%10);
       //获取十位的数字
       printf("%d十位的数字是	%d
    ",j,(j/10)%10);//三位数除以10得一个两位的数字,再取余的十位的数字
       //获取百位的数字
       printf("%d百位的数字是	%d
    
    
    ",j,j/100);//
       printf("-------四位数----------
    ");
       //获取个位的数字
       printf("%d个位的数字是	%d
    ",a,a%10);
       //获取十位的数字
       printf("%d十位的数字是	%d
    ",a,(a/10)%10);
       //获取百位的数字
       printf("%d百位的数字是	%d
    ",a,a/100%10);//四位数除以100得一个两位的数字,再取余的十位的数字
       //取千位的数字
       printf("%d千位的数字是	%d
    
    
    ",a,a/1000); 
    }
  • 相关阅读:
    数学基础
    Codeforces Beta Round 84 (Div. 2 Only)
    Codeforces Round 256 (Div. 2)
    Codeforces Round FF(Div. 2)
    Codeforces Round 254 (Div. 2)
    Python3 集合(无序的set)
    Python3 字典(map)
    Python3 元组
    Python3 列表
    初等数论及其应用——唯一分解定理
  • 原文地址:https://www.cnblogs.com/kinson/p/6858128.html
Copyright © 2011-2022 走看看