www.3112.net > python输入20个学生的成绩

python输入20个学生的成绩

a=list(eval(input("input grades:")))a.sort()a.reverse()print("sorted:\n")print(a)c=list(eval(input("the grade rankto query:")))print("rank is:")print(a.index(c)+1)

count = 30 s = [] for i in range(count): print(i+1) name = input('name:') score = input('score:') t = {} t['name'] = name t['score'] = int(score) s += [t] max = 0 min = 0 sum = 0 for i in range(count): if max s[i]['score']: min = i sum +=s[i]['score'] print('max:' + s[

#include <stdio.h> int main() { int i, n; int excellent, pass, fail; excellent = pass = fail = 0; for(i=0;i<20;i++) { scanf("%d", &n); if(n>85) excellent++; else if(n>=60) pass++; else fail++; } printf("excellent :%d, pass :%d, fail: %d\n", excellent, pass, fail); }

namespace test { class Program { static void Main(string[] args) { int [] scoreArr = {65,78,31,98,11,99,88,99,87,100,43,66,74,32,76,73,82,11,32,66}; for (int i = 0; i < scoreArr.Length;i++ ) { Console.Write(scoreArr[i].ToString()+","); if (i == scoreArr.

// ask.cpp : Defines the entry point for the console application.//#include "stdafx.h" int FindMaxNum(int scrol[], long num[], const int n, long* pMaxNum); int main(int argc, char* argv[]) { const int n = 20;//学生个数控制 //初始化学生数组和分数数组

#include <stdio.h> main() {int i,s=0,a[20];float avg; for(i=0,i<20,i++) { scanf("%d",&a[i]); s=s+a[i]; }; avg=s/20.0; printf("%f",avg); } 我想成绩一般是整型吧,但平均成绩应该是浮点型吧

#includeint findmax(int score[],int n){int i,j,temp;for(i=0;i 评论0 0 0

学生的数量我们并不知道有多少,有可能是1个学生,但也有可能是100000个学生 但是我们能确定的是学生的学号,因为每个学生的学号都是不一样的(除非出现意外情况) 那么我们可以以学生的学号来排序,比如000是小明,那么我们把000

#include<iostream>#define N 20 using namespace std; struct student { char name[10]; double score; }a[N]; int main() { int i,j=0,k=0; cout<<"请输入e799bee5baa6e4b893e5b19e31333330333566学生1的姓名:"; cin>>a[0].name; cout<<"请输

#include<stdio.h> struct Student{ char num[24]; int fenshu; }; void main() { int i,sum=0; Student stu[20]; for(i=0;i<20;i++) { printf("请输入第%d个学生的学号:",i+1); scanf("%s",stu[i].num); printf("请输入第%d个学生的成绩:",i+1);

网站地图

All rights reserved Powered by www.3112.net

copyright ©right 2010-2021。
www.3112.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com