[编程入门]水仙花数判断-题解(C++代码) 摘要:解题思路:遍历从100到999的所有三位数,然后写个bool函数判断是否满足题目条件,因为只有三位数,我们可以用to_string函数先将其转换为字符串,然后得到各个位置的数,当然while也是可以的…… 题解列表 2021年01月26日 0 点赞 0 评论 572 浏览 评分:2.0
水仙花数判断-三种求解方法 摘要:参考代码:class Solution { //题目描述 //打印出所有"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该本身。 例如:153是一个水仙花数,因为153=1^3+…… 题解列表 2021年09月27日 0 点赞 0 评论 643 浏览 评分:2.0
1016: [编程入门]水仙花数判断 摘要:解题思路:注意事项:参考代码:#include <iostream> #include <cmath> using namespace std; int main() { for (…… 题解列表 2022年10月08日 0 点赞 0 评论 245 浏览 评分:2.0
C语言程序设计教程(第三版)课后习题6.6 (C语言代码) 摘要:#include<stdio.h>int main(){ int a, b, c; for (a = 1; a <= 9; a++) {for (b = 0; b <= 9; b++) {for (…… 题解列表 2017年06月12日 4 点赞 2 评论 999 浏览 评分:0.0
C语言程序设计教程(第三版)课后习题6.6 (C语言代码) 摘要://使用while循环解题#include <stdio.h>int main(){ //定义循环变量i int i = 100; //定义百位、十位及个位的变量 //定义求和…… 题解列表 2017年06月29日 0 点赞 0 评论 966 浏览 评分:0.0
C语言程序设计教程(第三版)课后习题6.6 (Java代码) 摘要:public class Main { public static void flower(){ for(int i=100;i<1000;i++)…… 题解列表 2017年07月05日 3 点赞 0 评论 1511 浏览 评分:0.0
C语言程序设计教程(第三版)课后习题6.6 (C语言代码) 摘要:解题思路:正确表达a,b,c和水仙花数的关系注意事项:参考代码:#include<stdio.h>main(){int x,a,b,c;for(x=100;x<=999;x++){a=x/100;b=…… 题解列表 2017年07月18日 0 点赞 0 评论 982 浏览 评分:0.0
C语言程序设计教程(第三版)课后习题6.6 (C语言代码) 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int i ; char buf[4]; int a,b,c; int tem; for (i = 100…… 题解列表 2017年07月19日 0 点赞 0 评论 1066 浏览 评分:0.0
C语言程序设计教程(第三版)课后习题6.6 (C++代码) 摘要:解题思路:注意事项:参考代码:#include <cstdio>int main(){ int i,j,k,t; for(int a=100;a <1000;a ++) { …… 题解列表 2017年07月27日 0 点赞 0 评论 1115 浏览 评分:0.0
C语言程序设计教程(第三版)课后习题6.6 (C语言代码) 摘要:解题思路:显然,水仙花数只能在2—999中取得,因此设i的起始值是2,最大值是999。用ge=i%10取i的个位数,用shi=i/10%10取十位,再用bai=i/100取百位。最后判断:if(i==…… 题解列表 2017年09月22日 4 点赞 2 评论 838 浏览 评分:0.0