网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
以下程序的功能是求两个整数的余数,请补充完整程序代码。 #include<stdio.h> int main() { int a,b,s1; scanf("%d%d",&a,&b); s1=a b; printf("余数=%dn",s1); }
参考答案和解析
t=n1%n2和n1
更多 “以下程序的功能是求两个整数的余数,请补充完整程序代码。 #include<stdio.h> int main() { int a,b,s1; scanf("%d%d",a,b); s1=a b; printf("余数=%dn",s1); }” 相关考题
考题
请将以下程序中的函数声明语句补充完整。#include stdio.hint 【 1 2 】 ;main(){ int x,y,(*p)();scanf("%d%d",x,y);p=max;printf("%d\n",(*p)(x,y));}int max(int a,int b){ return(ab?a:b);}
考题
有以下程序 include main() { int n,*p=NULL; *p=n; printf("
有以下程序 #include <stdio.h> main() { int n,*p=NULL; *p=n; printf("Input n:");scanf("%d",p);printf("output n:");printf("%d\n",p); } 该程序试图通过指针p为变量n读入数据并输出,但程序有多处错误,以下语句正确的是A.int n,*p=NULL;B.*p=n;C.scanf("%d",p)D.printf("%d\n",p);
考题
为使*p=20,下面正确的程序是()A. include main( ) { int a=10,b=20,*p= printf
为使*p=20,下面正确的程序是 ( )A.# include<stdio.h> main( ) { int a=10,b=20,*p=&b; printf("%d\t%d\n",p,*p); } *p)B.# include<stdio.h> main( ) { int a=10,b=20,*p=b; printf("%d\t\%d\n",p,*p) }C.# include<stdio.h> main( ) { int a=10,b=20,*p; p=&a; p + +; printf("%d\t\%d\n",p,*p);} }D.# include<stdio.h> main( ) { int a=10,b=20,*p; *p=20; printf("%d\t\%d\n",p,*p); }
考题
下列给定程序中,函数fun()的功能是:实现两个整数的交换。例如给a和b分别输入60和65,输出为:a=65 b=60请改正程序中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。试题程序;include<stdio.h>include <conio.h>/*************found**************/void fun(int a,b){ int t;/*************found**************/t=b;b=a;a=t;}main(){ int a,b;clrscr();printf("Enter a, b: "); scanf("%d%d",a,b);fun(a, b);printf("a=%d b=%d\n ", a,b);}
考题
下列程序的运行结果是()。includeincludemain(){ char*s1="ahDuj";char*s2=
下列程序的运行结果是( )。#include<stdio.h>#include<string.h>main(){ char*s1="ahDuj"; char*s2="ABdUG": int t; t=strcmp(s1,s2); printf("%d", t);}A.正数B.负数C.零D.不确定的值
考题
有以下程序并includeincludefun(char * w,int n){char t,*s1,*s2; s1=w;s2=
有以下程序 并include<stdio.h> #include<string.h> fun(char * w,int n) { char t,*s1,*s2; s1=w; s2=w+n-1; while(s1<s2) { t=*s1++; * s1=*s2--; * s2=t; } } main() { char p[]="1234567"; fun(p,strlen(p)); puts(p); } 程序运行后的输出结果是( )A.1234567B.7654321C.1711717D.7177171
考题
以下程序的输出结果是( )。 includefun(){ int a=0;a+=3;printf("%d",A); } main() {int
以下程序的输出结果是( )。include<stdio.h>fun(){ int a=0;a+=3;printf("%d",A);}main(){ int cc;for(cc=1;cc<=4;cc++)fun();printf("\n");}
考题
有如下程序: include using namespace std; int main(){ int a[6]={23, 15, 64, 33,
有如下程序:#include<iostream>using namespace std;int main(){int a[6]={23, 15, 64, 33, 40, 58};int s1, s2;s1, s2=a[0];for(int*p=a+1; p<a+6; p++) {if(s1>*p)s1=*p;if(s2<*p)s2=*p;}cout<<s1+s2<<end1;return 0;}运行时的输出结果是( )。A) 23B) 58C) 64D) 79A.B.C.D.
考题
以下程序的功能是:从低位开始取出长整型变量s中奇数位上的数,依次构成一个新数放在t中。高位仍在高位,低位仍在低位。请填空。 include<stdio.h> main() {long s,t,s1=10; pfintf("\n.Please enter s:"); scanf("%1d",s); t=s%10; while(s>0) {s=s/100; t=( ); s1=s1*10; } printf("The result is:%1d\n",t); }
考题
下列程序的运行结果是()。 include include main() {char*s1="abDuj"; char
下列程序的运行结果是( )。#include<stdio.h>#include<string.h>main(){ char*s1="abDuj";char*s2="ABdUG";int t;t=strcmp(s1,s2) ;printf("%d",t);}A.正数B.负数C.零D.不确定的值
考题
请将以下程序中的函数声明语补充完整。 include int【】 main(){int x,y,(*p)(); sccanf("
请将以下程序中的函数声明语补充完整。include<stdio.h>int【 】main(){ int x,y,(*p)();sccanf("%d%d",x,y);p=max;printf(%d\n",(*p)(x,y));}int max(int a,int b){return(a>b?a:b);}
考题
以下程序的输出结果是()。include main(){int i; for(i=1;i
以下程序的输出结果是( )。 #include <stdio.h> main() { int i; for(i=1;i<5;i++) { if(i%2) printf("*"); else continue; printf("#"); } printf("$\n");A.*#*#*#$B.#*#*#*$C.*#*#$D.#*#*$
考题
以下程序的输出结果是______。includeincludefun(char*w,int n){ char t,*s
以下程序的输出结果是______。 #include<stdio.h> #include<string.h> fun(char*w,int n) { char t,*s1,*s2; s1=w;s2=w+n-1; while(s1<s2) { t=*s1++; *s1=*s2-; *s2=t; } } main() { char*p; p="1234567"; fun(p,strlen(p)); puts(p); }A.1234567B.7654321C.1711717D.7177171
考题
请读程序:includeincludemain(){char *s1="AbCdEf",*s2="aB"; s1++;s2++;
请读程序: #include<stdio.h> #include<string.h> main() { char *s1="AbCdEf",*s2="aB"; s1++;s2++; printf("%d\n",strcmp(s1,s2)); } 上面程序的输出结果是______。A.正数B.负数C.零D.不确定的值
考题
若执行下列程序时从键盘上输入2,则输出结果是()。 inclUde main() {int a; scanf("%d",
若执行下列程序时从键盘上输入2,则输出结果是( )。#inclUde<stdio.h>main(){int a;scanf("%d",A);if(a++<3)printf("%d\n",A);else printf("%d\n",a--);}A.1B.3C.2D.4
考题
有以下程序include main(){int x; scanf("%d",x); if(x
有以下程序 #include <stdio.h> main() { int x; scanf("%d",x); if(x<=3); else if(x!=1O) printf("%d\n",x); } 程序运行时,输入的值在______范围才会有输出结果。A.不等于10的整数B.大于3且不等10的整数C.大于3或等于10的整数D.小于3的整数
考题
以下程序运行后的输出结果是( )。 include main() { int x=20; printf("%d", 0
以下程序运行后的输出结果是( )。include<stdio.h>main(){ int x=20;printf("%d", 0<x<20);printf("%d\n", 0<x x<20);}
考题
以下程序的功能是:将输入的正整数按逆序输出。例如:若输入135则输出531。请填空。include <stdio.h>main(){ int n, s;printf("Enter a number:"); scanf("%d",n);printf("Output: ");do{ s=n%10; printf("%d",s); [ ]; }while (n!=0);printf("\n');}
考题
阅读以下程序: include void main() { static int a[][3]={9,7,5,3,1,2,4,6,8}; int
阅读以下程序:include<iostream.h>void main(){static int a[][3]={9,7,5,3,1,2,4,6,8};int i,j,s1=0,s2=0;for(i=0;i<3;i++)for(j=0;j<3;j++){if(i==j)s1=sl+a[i][j];if(i+j==2)s2=s2+a[i][j];}cout<<s1<<","<<s2<<endl;}则该程序的输出结果为【 】。
考题
下列的程序用来输出两个字符串前7个字符中对应相等的字符及其位置号,程序空白处应该填写的是( )。 #include<stdio.h> main() { Char sl[]="Chinese",s2[]="japnese"; int i; for(i=0;s1[i]!='\0's2[i]!='\0';i++) if(s1[i]=s2[i]i<7) ____________________; }A.putchar(s2[i];putchar(i)B.puts(s1[i],i)C.printf("%c%d\n",s2[i],i)D.printf("%c",s1[i]);printf("%d\n",i)
考题
以下程序的输出结果是_______。includeincludefun(char*w,int n){char t,*s
以下程序的输出结果是_______。 #include<stdio.h> #include<string.h> fun(char*w,int n) { char t,*s1,*s2; s1=w;s2=w+n-1; while(s1<s2) { t=*s1++: *sl=*s2-; *s2=t; } } main() { char*p; p="1234567"; fun(p,strlen(p)); puts(p); }A.1234567B.7654321C.1711717D.7177171
考题
设有如下程序: #include'string.h" main() { static char s1[20],s2[20]; scanf("%s",s1);scanf("%s",s2); if(strcmp(s1,s2)) printf("@"); else printf("$"); printf("%d\n",strlen(strcat(s1,s2))); } 如果从键盘上输入name1<回车>name2<回车>,则程序运行后的输出结果是( )。A.$9B.@11C.$10D.@10
考题
请补充函数fun(),该函数的功能是计算下面公式SN的值:例如:当N=50时,SN=71.433699。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include<conio.h>include<stdio.h>double fun(int n){double s=1.0,S1=0.0;int k;for(【l】;k<=n;k++){s1=s;【 】;}return【 】;}main(){int k=0;double S;clrscr();printf("\nPlease input N=");scanf("%d",k);s=fun(k);printf("\ns=%lf",s);}
考题
有以下程序:include using namespace std;int main ( ){ char s1[10],s2[10]; char*p
有以下程序: #include <iostream> using namespace std; int main ( ) { char s1[10],s2[10]; char *p=s1,*q=s2; cin>>s1>>s2; while (*p ! =' \0 ' ) p++; while (*q!='\0') *p++=*q++; *p='\0'; cout<<s1<<end1; return 0; }A.abcd0ghijB.abcd0ghij0C.abcdD.abcdghij
考题
若输入“abcdef”“abdef”,下述程序的输出结果为( )。#include#includemain{int n;char s1[20],s2[20],*p1,*p2;scanf(%s,s1);scanf(%S,s2);p1=s1;p2=s2;n=strcmp(p1,p2);printf(Vood\n,n); }A.-1B.0C.abcdefD.abdef
考题
下面程序的运行结果是______。 include include fun(char*w,int n) { char
下面程序的运行结果是______。 #include<stdio.h> #include<string.h> fun(char*w,int n) { char t,*s1,*s2; s1=w;s2=w+n-1; while(s1<s2) {t=*s1++;*s1=*s2--;*s2=t;} } main() { char*p; p="1234567"; fun(p,strlen(p)); puts(p); }A.7654321B.1714171C.1711717D.7177171
热门标签
最新试卷