#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
int i,j = 0;
int a1,a2,a3,a4;
printf("输入一个4位正整数:\n");
scanf("%d",&i);
a1 = i/1000;
a2 = i/100%10;
a3 = i/10%10;
a4 = i%10;
printf("千位a1=%d,百位a2=%d,十位a3=%d,个位a4=%d\n",a1,a2,a3,a4);
j = 1000*a4 + 100*a3 + 10*a2 + a1;
printf("逆数j=%d\n",j);
return 0;
}
C语言——输入一个4位正整数,输出其逆数。
于 2023-11-24 20:39:14 首次发布