以下程序的功能是计算函数F(x,y,z)=(x+y)/(x-y)+(z+y)/(z-y)的值,请选择填空。#include #include float f(float,float);main(){float x,y,z,sum;scanf("%f%f%f",&x,&y,&z);sum=f(【1】)+f(【2】);printf("sum=%f\n",sum);}float f(float a,float b){float value;falue=a/b;return(value);}
查看答案
以下程序是选出能被3整除且至少有一位是5的两位数,打印出所有的这样的数及其个数。请选择填空。sub(int k,int n){int a1,a2;a2=【1】;a1=k-【2】;if((k%3==0&&a2==5)||(k%3==0&&a1==5)){printf("%4d",k);n++;return n;}else return -1;}main(){int n=0,k,m;for(k=10;k<100;k++){m=sub(k,n);if(m!=-1) n=m;}printf("\nn=%d",n);}
以下程序的功能是根据输入的"y"("Y")与"n"("N"),在屏幕上分别显示出"This is YES."与"This is NO."。请填空。#includevoid YesNo(char ch){switch(ch){case 'y':case 'Y':printf("\nThis is YES.\n");【1】;case 'n':case 'N':printf("\nThis is NO.\n");}}main(){char ch;printf("\nEnter a char 'y','Y' or 'n','N':");ch=【2】;printf("ch:%c",ch);YesNo(ch);}
以下Check函数的功能是对value中的值进行四舍五入计算,若计算后的值与ponse值相等,则显示"WELL DONE!!",否则显示计算后的值。已有函数调用语句Check(ponse,value);请填空。void Check(int ponse,float value){int val;val=【1】;printf("计算后的值:%d",val);if(【2】) printf("\nWELL DONE!!!\n");else printf("\nSorry the correct answer is %d\n",val);}
以下程序的运行结果是输出如下图形。请填空。*************************#include void a(int i){int j,k;for(j=0;j<=7-i;j++) printf(" ");for(k=0;k<【1】;k++) printf("*");printf("\n");}main(){int i;for(i=0;i<3;i++) 【2】;for(i=3;i>=0;i--) 【3】;}