C语言的题,大家帮助我啊!!

来源:百度知道 编辑:UC知道 时间:2024/04/29 12:51:20
1、输入10个学生成绩,求平均分,并找出高于平均分的同学!
2.用递归法判断输入的字符是否为回文!
3.用函数将一种进制转化成另一种进制!

楼主以后要多努力了!

1.

#include <stdio.h>
#define STU_NUM 10

main()
{
int stu[STU_NUM];
int total=0;
double ave=0;
printf("Please input scores for 10 students: \n");
for(int i=0; i<STU_NUM; i++)
{
scanf("%d", &stu[i]);
total+= stu[i];
}

ave= (double) total / STU_NUM;
printf("\nThe average score is: %f", ave);
printf("\nThe scores which are below average are: ");
for(i=0; i<STU_NUM;i++){
if(stu[i] < ave)
printf("%4d", stu[i]);
}
getch();
getch();
}

2.

#include<stdio.h>
int ishuiwen(char *k) // 判断回文函数
{
char *q=k; //q指针指向字符串的首地址
while(*q!='\0')q++; //如果q指向的单元不是字符串的结束标志,则q自增,直到q指向'\0'
//注:当输入一个字符串时,