1、获取变量的最后一位数字

#include <stdio.h>

int main(void)
{
    int i;
    puts("please input an integer.");
    printf("i = "); scanf("%d", &i);
    
    printf("The last number of i is: %d", i % 10);
    return 0;
 } 

c语言中获取变量的最后一位数字、两位数字

 

 

 c语言中获取变量的最后一位数字、两位数字

 

 

 2、获取变量的最后两位数字

#include <stdio.h>

int main(void)
{
    int i;
    puts("please input an integer.");
    printf("i = "); scanf("%d", &i);
    
    printf("the last two number of i is: %d\n", i % 100);
    return 0;
}

c语言中获取变量的最后一位数字、两位数字

 

 c语言中获取变量的最后一位数字、两位数字

 

相关文章:

  • 2021-04-26
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
猜你喜欢
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
  • 2021-12-01
  • 2021-06-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案