欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

c語言函數(shù)簡單題 c語言考試常用函數(shù)

一個簡單的C語言函數(shù)題

#includestdio.h

網(wǎng)站的建設創(chuàng)新互聯(lián)專注網(wǎng)站定制,經(jīng)驗豐富,不做模板,主營網(wǎng)站定制開發(fā).小程序定制開發(fā),H5頁面制作!給你煥然一新的設計體驗!已為自上料攪拌車等企業(yè)提供專業(yè)服務。

#define STUDENT 10

#define CLASS 5

int student_i=0,class_i=0;

main()

{

void average(int course[STUDENT][CLASS], float aver[CLASS]);

void highest(int course[STUDENT][CLASS]);

int course[STUDENT][CLASS] = {{38, 45, 52, 70, 88}, {47, 58, 19, 65, 48},

{80, 19, 64, 5, 47}, {81, 69, 9, 43, 88}, {10, 96, 28, 90, 33},

{4, 88, 22, 43, 32}, {17, 94, 70, 67, 19}, {27, 82, 86, 67, 98},

{34, 4, 92, 15, 84}, {57, 9, 66, 76, 65}};

float aver[CLASS]={0};

average(course, aver);

highest(course);

}

void average(int course[STUDENT][CLASS], float aver[CLASS])

{

int i,j;

for(i=0;iCLASS;i++)

for(j=0;jSTUDENT;j++)

aver[i]+=course[j][i];

printf("每一門課程的平均分:\n");

for(i=0;iCLASS;i++)

printf("%5.2f\n",aver[i]/=10);

printf("\n");

}

void highest(int course[STUDENT][CLASS])

{

int i,j;

int highest;

for(i=0;iCLASS;i++)

{

highest=course[0][i];

for(j=0;jSTUDENT;j++)

if(course[j][i]highest)

{highest=course[j][i];

student_i=j;

class_i=i;}

printf("第%d門課程分神伏數(shù)最高的學生及其課程:第%d名學生胡擾的第%d門課程分數(shù)為%d\n",i+1,student_i+1, class_i+1,highest);

}

}

你看看行不褲瞎旦行

求高手解答一些簡單的C語言題目!(高分懸賞)

1、

Before GlobalPlusPlus(), it is 1

Before ++, it is 1

After ++, it is 2

After GlobalPlusPlus(), it is 2

2、

over!

3、

(1)

printf("Input a year:");

scanf("%d",year);

(2)

(0==year%4 0!=year%100) || 0==year%400

4、

(1)

s[i]!='\0'

(2)

s[j]=s[i];

5、

#includestdio.h

main()

{

int i=1,j=1;

for(i=1;i=9;i++)

{

for(j=1;j=9;j++)

{

if(j=i)

{

printf("%2d*%2d=%2d",i,j,i*j);

}

else

{

printf(" ");

}

}

printf("\n");

}

}

6、

#includestdio.h

main()

{

int i=1;

long sum=0;

for(i=1;i=100;i++)

{

sum += i;

}

printf("1~100的累加和為:%ld\n",sum);

}

7、

#includestdio.h

void GetMaxMin(float s[])

{

int i,max,min;

min=0;/*假設第一是最小的*/

max=0;/*假設第一是最大的*/

for(i=0;i10;i++)

{

if(s[min]s[i])

{

min=i; /*有比當記錄還小的就記錄下他的下標*/

}

if(s[max]s[i])

{

max=i; /*有比當記錄還大的就記錄下他的下標*/

}

}

printf("數(shù)組的最小值:%.2f\n數(shù)組的最大值%.2f\n",s[min],s[max]);

}

main()

{

int i;

float s[10];

printf("求數(shù)組中最小最小值\n\n");

printf("請輸入10個數(shù):\n");

for(i=0;i10;i++)

scanf("%f",s[i]);

GetMaxMin(s);

}

8、怎么有是乘法讓敗表呀,上面有個上三角,這里就弄個下三角!

#includestdio.h

main()

{

int i=1,j=1;

for(i=1;i=9;i++)

{

for(j=1;j=i;j++)

{

printf("%2d*%2d=%2d",j,i,i*j);

}

printf("\n");

}

}

9、

#include stdio.h

#include math.h

#define TRUE 1

#define FAULSE 0

/*isprime 的返回值為激沒0,n不是素數(shù);返回值為1,n是素數(shù)。*/

int isprime(int n)

{

int i;

if(2==n)

{

return TRUE;

}

if(0==n%2)

{

return FAULSE;

}

for(i=3;i=sqrt(n);i+=2)

{

if(n%i==0)

{

return FAULSE;

}

else if(isqrt(n))

{

return TRUE;

}

}

}

void main()

{

int number=0;

do{

printf("請一個大明滑納于1正整數(shù):");

fflush(stdin);

scanf("%d",number);

}while(number2);

if(isprime(number))

printf("%d是一個素數(shù)!\n",number);

else printf("%d不是一個素數(shù)!\n",number);

}

10、

#include stdio.h

long fac(int n)

{

if(0==n || 1==n)

return 1;

else return n*fac(n-1);

}

void main()

{

int m=-1,k=-1;

do{

printf("請一個非負整數(shù)m:");

fflush(stdin);

scanf("%d",m);

}while(m0);

do{

printf("請一個不大于%d的非負整數(shù)k:",m);

fflush(stdin);

scanf("%d",k);

}while(k0);

printf("%ld\n",fac(k)/fac(m-k));

}

11、

#include stdio.h

void main()

{

char ch;

int letter=0,integer=0,space=0,other=0;

printf("請輸入字符串:\n");

while((ch=getchar()) !=10)

{

if((ch='a' ch='z') || (ch='A' ch='Z'))

letter++;

else if(ch='0' ch='9')

integer++;

else if(ch==32 || ch==9)

space++;

else other++;

}

printf("英語字符:%d\n",letter);

printf("數(shù)字字符:%d\n",integer);

printf("空格字符:%d\n",space);

printf("其他字符:%d\n",other);

}

當前題目:c語言函數(shù)簡單題 c語言考試常用函數(shù)
轉載注明:http://chinadenli.net/article21/dsppscd.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)頁設計公司小程序開發(fā)標簽優(yōu)化品牌網(wǎng)站制作網(wǎng)站維護虛擬主機

廣告

聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

手機網(wǎng)站建設