#include <stdio.h>

int Reverse(int n) {
    int temp = n, reverse = 0;
    while (temp > 0) {
        reverse = reverse * 10 + temp % 10;
        temp /= 10;
    }
    if (reverse == n) {
        return 1;
    } else {
        return 0;
    }
}

int main() {
    int count = 0;
    for (int i = 10; i <= 999; i++) {
        if (Reverse(i)) {
            printf("%d ", i);
            count++;
            if (count % 5 == 0) {
                printf("\n");
            }
        }
    }
    return 0;
}
``
c语言练习简单变量作为函数参数: 1编写函数Reverse判断整数N是否为回文数。若是回文数则返回1否则返回0。 2编写函数main输出10~999之间的回文数每个数据后跟一个空格且5个一行。

原文地址: https://www.cveoy.top/t/topic/dVEO 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录