C语言一辆卡车撞人逃逸。现场三人目击事件,只记下车的一些特征。甲说:牌照的前两位数字是相同的;乙说:牌照的后两位数字是相同的;丙是位数学家说:四位的车号正好是一个整数的平方

#include <stdio.h>
#include <math.h>

void main()

{

 int a, b, c, d, n, h;

 double t;

 for (n = 1000; n < 10000; n++)

 {

 a = n / 1000;

 b = (n - a * 1000) / 100;

 d = n % 10;

 c = (n % 100 - d) / 10;

 t = sqrt(n);

 h = sqrt(n);

 t = t - h;

 if (a == b && d == c && t == 0)

 printf("%d", n);

 else continue;

 }

}

 

posted @ 2023-04-17 13:46  放氮气的蜗牛  阅读(68)  评论(0编辑  收藏  举报  来源