感谢支持,谢谢你们的支持 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;int main(){ int n,age,sum=0 ; cin>>…… 题解列表 2023年07月01日 0 点赞 0 评论 417 浏览 评分:0.0
求平均年龄 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;int main(){ int n,sum=0,age; cin>>n…… 题解列表 2023年07月01日 0 点赞 0 评论 321 浏览 评分:0.0
求平均年龄 摘要:解题思路:注意事项:注意乘上1.0参考代码:#include<stdio.h>int main(){ int i,n,a[100],s=0; scanf("%d",&n); for(…… 题解列表 2022年12月25日 0 点赞 0 评论 365 浏览 评分:0.0
循环控制--1.求平均年龄 摘要:解题思路: 刚开始用了数组,大小是10,我说怎么出错了呐。一看题目是1<=n<=100。这个题不用数组就很方便,for循环里面输进去一个数,然后加到sum上。注意事项:sum必须设为float型;参考…… 题解列表 2023年03月24日 0 点赞 0 评论 296 浏览 评分:0.0
编写题解 2794: 求平均年龄 摘要:解题思路:注意事项:参考代码:#include <stdio.h>int main() { int n; scanf("%d", &n); int a[n]; for (int…… 题解列表 2023年04月25日 0 点赞 0 评论 370 浏览 评分:0.0
班上有学生若干名,给出每名学生的年龄(整数),求班上所有学生的平均年龄,保留到小数点后两位。 摘要:解题思路:注意事项:参考代码: #include<stdio.h>int main(){ int n,i,z; double sum=0; scanf("%d",&n); for(i=1;i<=n;i…… 题解列表 2023年11月16日 0 点赞 0 评论 474 浏览 评分:2.0
python编写题解 2794: 求平均年龄 摘要:参考代码:n = map(int, input().split()) n = list(n) if len(n) == 1: ages = [int(input()) for i in …… 题解列表 2024年03月11日 1 点赞 0 评论 674 浏览 评分:2.0
编写题解 2794: 求平均年龄 摘要:解题思路:首先使用 Scanner 类获取输入的数据。接下来,使用 for 循环遍历每个学生的年龄,将其加到年龄总和变量 sum 中。计算平均年龄,将年龄总和除以学生人数,需要将其转换为 double…… 题解列表 2023年04月17日 0 点赞 0 评论 575 浏览 评分:2.0
用数组加循环赖算平均你是哪里人 摘要:解题思路:先定义一个动态数组,再用一个循环给数组进行赋值注意事项:参考代码:#include<stdio.h>int main(){ int n;//学生人数 float add = 0.0; sca…… 题解列表 2022年10月22日 0 点赞 1 评论 449 浏览 评分:4.0
题解 2794: 求平均年龄 摘要:解题思路:注意事项:参考代码:#include<stdio.h>#define N 100int main(){ int n, age[N]; int i, sum=0; float…… 题解列表 2023年08月17日 0 点赞 0 评论 441 浏览 评分:6.0