的序号,当输入负数时结束输入。
6.从键盘上输入若干学生的一门课成绩,计算出平均分,当输入负数时结束输入。将结果输出。
7.求1!+2!+3!+ +20!,将结果输出。
#include<stdio.h>
void main()
{
float s=0,t=1;
int n;
for(n=1;n<=20;n++)
{
t=t*n;
s=s+t;
}
printf("1!+2!+3!+ +20!=%e\n",s);
}
8.打印以下图案: *
***
*****
*******
#include<stdio.h>
void main()
{
int i,j;
printf("The picture is:\n");
static char picture[4][7]={{' ',' ',' ','*'},
{' ',' ','*','*','*'},{'
*','*','*','*','*'},{'*','*','*','*','*','*','*'}};
for(i=0;i<=3;i++)
{
for(j=0;j<=6;j++)
printf("%c",picture[i][j]);
printf("\n");
}
}
9.打印以下图案:
*
**
***
****
#include<stdio.h>
void main()
{
int i,j; ','
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库c语言大题(4)在线全文阅读。
相关推荐: