
int main()
{
char ch1, ch2
printf("Please enter two characters: ")
scanf("%c %c", &ch1, &ch2)
printf("The characters you entered are %c and %c.\n", ch1, ch2)
printf("或梁Now I will show you other characters:\n")
printf("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z\n")
printf("a b c d e f g h i j k l m n o p q r s t u v w x y z\n"衫念运)
printf("0 1 2 3 4 5 6 7 8 9 ! @ # $ % ^ &* ( ) - + =\n"高冲)
return 0
}
#include <stdio.h>#include <math.h>
int main(int argc, char*argv[])
{
printf("输入一个四耐答位数:")
int input
scanf("%4d",&input)
int nWeiShu = 0
for (nWeiShu <4++nWeiShu)
{
if (0 == (input / (int)pow(10 * 1.0, nWeiShu * 1.0)))
{
break
}
}
printf("实际位数:%d\n", nWeiShu)
// 根据位数倒推数字
int output = 0
for (int i = 1i <= nWeiShu++i)
{
int value = (int)pow(10 * 1.0, (nWeiShu - i) * 1.0)
int temp = input / value
input -= temp * value
output += temp * (int)pow(10 * 1.0, (i-1) * 1.0)
}
output*= (int)pow(10 * 1.0, (4-nWeiShu) * 1.0)
printf("输出:键举%04d\n", output)
return 0
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)