更多"下面程序段可以求出n!的值。 #include<stdio.h> "的相关试题:
[填空题]下面程序段可以求出n!的值。
#include<stdio.h>
main( )
{int i,n;
long np;
scanf("%d",&n);
______;/*第一空*/
for(i=2;______;i++)/*第二空*/
______;/*第三空*/
printf("n=%d,n!=%ld/n",n,np);
}
[单项选择]阅读下面程序,则程序段的功能是
#include"stdio.h"
main( )
int c[]=23,1,56,234,7,0,34,i,j,t;
for(i=1;i<7;i++)
t=c[i];j=i-1;
while(j>=0 && t>c[j])
c[j+1]=c[j];j--;
c[j+1]=t;
for(i=0;i<7;i++)
printf("%d",c[i]);
putchar(’/n’);
A. 对数组元素的升序排列
B. 对数组元素的降序排列
C. 对数组元素的倒序排列
D. 对数组元素的随机排列
[单项选择]阅读下面程序段,则执行后的结果为
#include "stdio.h"
main( )
int m=4,n=2,k;
k=fun(m,n);
printf("%d/n",k);
fun(int m,int n)
return(m*m*m-n*n*n);
A. 64
B. 8
C. 56
D. 0
[单项选择]现有如下程序段
#include"stdio.h"
main( )
int k[30]=12,324,45,6,768,98,21,34,453,456;
int count=0,i=0;
while(k[i])
if(k[i]%2==0‖k[i]%5==0)count++;
i++;
printf("%d,%d/n",count,i);
则程序段的输出结果为
A. 7,8
B. 8,8
C. 7,10
D. 8,10
[单项选择]现有如下程序段
#include "stdio.h"
main( )
int k[30]=12,324,45,6,768,98,21,34,453,456;
int count=0,i=0;
while(L[i])
if(k[i]%2==0||k[i]%5==0)count++;
i++;
printf("%d,%d/n",count,i);
则程序段的输出结果为
A. 7,8
B. 8,8
C. 7,10
D. 8,10
[单项选择]现有如下程序段:
#include <stdio.h>
main( )
int k[30]=12, 324, 45, 6, 768, 98, 21, 34, 453, 456;
int count=0, i=0;
while(k[i])
if(k[i]%2==0||k[i]%5==0) count++;
i++;
printf("%d, %d/n", count, i);
则程序段的输出结果为( )。
A. 7, 8
B. 8, 8
C. 7, 10
D. 8, 10
[单项选择]现有如下程序段:
#include "stdio.h"
main( )
int a[5][6]=23,3,65,21,6,78,28,5,67,25,435,76,8,22,45,7,8,34,6,78,32,4,5,67,4,21,1;
int i=0,j=5;
printf("%d/n",*(&a[0][0]+2*i+j-2));
则程序的输出结果是
A. 78
B. 23
C. 21
D. 28
[单项选择]若有以下程序段:
struct st
int n;
int*m:
;
int a=2,b=3,c=5;
struct st s[3]=(101,&a,102,&c,103,&b);
main( )
struct st*p;
p=s;
则以下表达式中值为5的是()。
A. (*p).m
B. *(p+1)->m
C. *(p++)->n
D. (p++)(*m)
[填空题]下列程序可以判断输入的年份是不是闰年。
#include
main( )
int 【11】 ,leap;
scanf("%d",&year);
if(year%4)
leap=0;
else if(year%lO0)
【12】 ;
else if(year%400)
leap=0;
else
leap=1;
if( 【13】 )
printf("%d年是闰年",year);
else
printf (" %d年不是闰年/n", year);
[单项选择]有以下程序段:
struct st
int x; int *y; ) *pt;
int a[]=1, 2), b[]=3, 4);
struct st c[2]=10, a, 20, b;
pt=c;
以下选项中表达式的值为11的是( )。
A. *pt->y
B. pt->x
C. ++pt->x
D. (pt++) ->x
[单项选择]若有以下程序段:
struct dent
int n;
int *m;
;
int a=1,b=2,c=3;
struct dent s[3]=101,&a,102,&b,103,&c;
struct dent *p=s;
则以下表达式中值为2的是( )。
A. (p++)->m
B. *(p++)->m
C. (*p).m
D. *(++p)->m
[填空题]#include<stdio.h>
#include
main( )
int i,a[10];
char b[10];
for(i=0;i<10;++i)
scanf("%d",a+i);
b="10 number":
printf("%s/n",b);
for(i=0;i<10;++i)
printf("%d";a[i]);
printf("/n");
错误:______
改正:______
[填空题]
[程序]
#include
void main(void)
{
int c2,c3,c5,m=20;
c2=c3=c5=0;
for(int i=1;i<=m;i++){
if(i==15 || i==14)continue;
if(i%2==0) c2++;
if(i%3==0) c3++;
if(i%7==0) c5++;
}
cout<
}
执行程序后输出的第一行是___(1)___, 第三行是___(2)___
[填空题]下列程序可以判断输入的年份是不是闰年。
#include
main( )
int______,leap;
scanf("%d",&year);
if(year%4)
leap=0;
else if(year%lO0)
______;
else if(year%400)
leap=0;
else
leap=1;
if(______)
printf("%d年是闰年",year);
else
printf (" %d年不是闰年/n", year);