网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
设a,s为int型变量,则下面循环语句执行后s的值? a=12345; while(a) { s=s+a % 10; a/=10; } printf("%dn",s);
A.10
B.15
C.20
D.死循环
参考答案和解析
C
更多 “设a,s为int型变量,则下面循环语句执行后s的值? a=12345; while(a) { s=s+a % 10; a/=10; } printf("%dn",s);A.10B.15C.20D.死循环” 相关考题
考题
以下程序的功能是:将输入的正整数按逆序输出。例如:若输入 135 则输出 531 。请填空。#include stdio.hmain(){ int n,s;printf("Enter a number : "); scanf("%d",n);printf("Output: ");do{ s=n%10; printf("%d",s); 【 10 】 ; }while(n!=0);printf("\n");}
考题
在下面循环语句中循环体执行的次数为( )。int i=0,s=0; while(s
在下面循环语句中循环体执行的次数为( )。int i=0,s=0; while(sA、4B、5C、6D、7
考题
若有定义和语句: char*sl="12345",* s2="1234"; printf("%d\n",strlen(stren(sl,s2))); 则输出结果 ( )A.4B.5C.9D.10
考题
若有以下定义和语句: char*s1="12345",*s2="1234"; printf("%d\n",strlen(strcpy(s1,s2)));则输出结果是______。A.4B.5C.9D.10
考题
以下程序的功能是:借助指针变量找出数组元素中最大值所在的位置并输出该最大值。请在输出语句中填写代表最大值的输出项。includestdio.hmain( ){int a[10],*p,*S;for(p=a;p-a10;p++)scanf(”%d”,p);for(p=a,s=a;p-a10;p++)if(*p*s)s=p;printf(”max=%d\n”,________);}
考题
有以下程序: int a=2; int f(int *a) {return (*a)++;) main() { int s=0; { int a=5; s+=f(a); } s+=f(a); printf("%d\n',s); } 执行后输出结果是( )。A.10B.9C.7D.8
考题
以下程序的功能是:借助指针变量找出数组元素中的最大值及其元素的下标值。请填空。inculde stdio.hmain(){ int a[10],*p,*s;For(p=a;p-a10;p++) scanF(“%d”,p)For(p=a;s+a;p-a10;p++) iF(*p*s)s=【 】;printF(“index=%d\n”,s-a);}
考题
有以下程序inc1udemain(){char*s={"ABC"}; do {printf("%d",*s%10);s++; }while(*s);
有以下程序 #inc1ude<stdio.h> main() { char*s={"ABC"}; do { printf("%d",*s%10); s++; } while(*s); } 注意字母A的ASCII码值为65。程序运行后的输出结果是______。A.5670B.656667C.567D.ABC
考题
有以下程序#includestdio.hvoid fun(int *s){ static int j=0;do { s[j]=s[j]+s[j+1]; )while(++j2);}main( ){ int k,a[10]={1,2,3,4,5);for(k=1;k3;k++)fun(a);for(k=0;k5;k++)printf(”%d”,a[k]);printf("\n");}程序运行后的输出结果是A) 12345B)23445C)34756D) 35745
考题
阅读下面程序,则执行后的输出结果为#includestdio.hfun(int a,int b){int s;s=a*b/2;printf(%d\n,s);}main(){int a=10,b=16;fun(a,b);}A.10B.16C.160D.80
考题
若有以下定义语句: char * sl="12345", * s2="1234"; printf("%d"n",strlen(strcpy(s1,s2))); 则输出结果是 ( )A.4B.5C.9D.10
考题
下列程序执行后,变量S的值为______ 。 Dim s As Long,X As Integer s=0 X=1 Do While x<10 s= s+ x x=x+2 Loop Print sA. 10B.25C.50D.100
考题
有以下程序 include int fun(char s[ ]) { int n=0; while(*s='0
有以下程序#include <stdio.h>int fun(char s[ ]){ int n=0;while(*s<='9'*s>='0') {n=10*n+*s-'0';s++;}retum(n);}main( ){ char s[10]={'6','1','*','4','*','9','*','0','*'};printf("%d\n",fun(s));}程序的运行结果是A.9B.61490C.61D.5
考题
执行下面的程序段后,变量k中的值为 include void main( ) { int k=3,s[2]; s[
执行下面的程序段后,变量k中的值为 #include<iostream.h> void main( ) { int k=3, s[2]; s[0]=k; k=s[1] *10; cout < < k;}A.不定值B.33C.30D.10
考题
类A有如下成员函数:int A::fun(double x){return (int) x/2;}int A::fun(int x){return x*2;}设a为类A的对象,在主函数中有int s=a.fun(6.0)+a.fun(2),则执行该语句后,s的值为()。
考题
单选题int i=0,s=0;while(s20){i++;s+=i;}在这个的while循环语句中,其循环体被执行的次数为()。A
4B
5C
6D
7
热门标签
最新试卷