2、stido.h>voidnum(){externintx,y;inta=15,b=10;x=a-b;y=a+b;}intx,y;main(){inta=7,b=5;x=a+b;y=a-b;num();printf(“%d,%d”,x,y);}3.以下程序的运行结果是.main(){inta=2,I;for(I=0;I<3;I++)printf(“4%d”,f(a));}f(inta){intb=0;staticintc=3;b++;c++;return(a+b+c);}4.以下程序的功能是根据输入的“y”(“Y”)与“n”(“N”),在屏幕上
3、分别显示出“ThisisYES.”与“ThisisNO.”。请填空。#includevoidYesNo(charch){switch(ch){case’y’:case’Y’:printf(“ThisisYES.”);break;case’n’:case’N’:printf(“ThisisNO.”)}}main(){charch;printf(“Enterachar‘y’,’Y’,or’n’,’N’);ch=___________________;printf(“ch:%c”,ch);YesNo(ch);}5.
4、以下Check函数的功能是对value中的值进行四舍五入计算,若计算后的值与ponse值相等,则显示“WELLDONE!!”,否则显示计算后的值。已有函数调用语句Check(ponse,value);请填空。VoidCheck(intponse,floatvalue){intval;val=_______________________________;printf(“计算后的值:%d”,val);if(_____________________)printf(“WELLDONE!!!”);elseprintf(“Sorrytheco
5、rrectis%d”,val);}6.若输入一个整数10,以下程序的运行结果是【】。main(){inta,e[10],c,i=0;printf(“输入一整数”);scanf(“%d”,&a);while(a!=0){c=sub(a);a=a/2;e[i]=c;i++}for(;i>0;i--)printf(“%d”,e[i-1]);}sub(inta){intc;c=a%2;returnc;}7.函数gongyu的作用是求整数num1和num2的最大公约数,并返回该值,请填空gongyu(intnum1,intnum2){inttemp
6、,a,b;if(num1______num2){temp=num1;num1=num2;num2=temp;}a=num1;b=num2;while(_________){temp=a%b;a=b;b=temp;}return(a);}8.下面函数pi的功能是:根据以下攻势,返回满足精度(0.0005)要求的pi的值pi1121231234─=1+─+──+───+────+···23353573579#include#include#includedoublepi(doubleeps)-140
7、-{doubles,t;intn;for(_____________;t>eps;n++){s+=t;t=n*t/(2*n+1);}return(__________);}main(){doublex;printf(“Pleaseenteraprecision:”);scanf(“%lf”,&x);printf(“eps=%lf,pi=%lf”,x,pi(x));}9.以下程序的运行结果是【】.#includemain(){printf("FACT(5):%d",fact(5));printf("FACT(1):%d
8、",fact(1));fact(-5);}fact(intvalue){if(value<0){printf("FACT(<0):E