题解 2794: 求平均年龄

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

求平均年龄

摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;int main(){    int n,sum=0,age;    cin>>n……

求平均年龄

摘要:解题思路:注意事项:注意乘上1.0参考代码:#include<stdio.h>int main(){    int i,n,a[100],s=0;    scanf("%d",&n);    for(……

循环控制--1.求平均年龄

摘要:解题思路: 刚开始用了数组,大小是10,我说怎么出错了呐。一看题目是1<=n<=100。这个题不用数组就很方便,for循环里面输进去一个数,然后加到sum上。注意事项:sum必须设为float型;参考……

编写题解 2794: 求平均年龄

摘要:解题思路:注意事项:参考代码:#include <stdio.h>int main() {    int n;    scanf("%d", &n);    int a[n];    for (int……

编写题解 2794: 求平均年龄

摘要:解题思路:首先使用 Scanner 类获取输入的数据。接下来,使用 for 循环遍历每个学生的年龄,将其加到年龄总和变量 sum 中。计算平均年龄,将年龄总和除以学生人数,需要将其转换为 double……

用数组加循环赖算平均你是哪里人

摘要:解题思路:先定义一个动态数组,再用一个循环给数组进行赋值注意事项:参考代码:#include<stdio.h>int main(){ int n;//学生人数 float add = 0.0; sca……

题解 2794: 求平均年龄

摘要:解题思路:注意事项:参考代码:#include<stdio.h>#define N 100int main(){    int n, age[N];    int i, sum=0;    float……

题解 2794: 求平均年龄

摘要:解题思路:套个循环……注意事项:别抄我的,抄我的人我诅咒他电脑立刻关机参考代码:#include<bits/stdc++.h>#include<windows.h>using namespace st……