程序填空题,根据下列各题题意,将程序补充完整下列程序输出6至10000之间的亲密数对#include void main(){ int a,b,c,i; for(a=6;a<=10000;a++) { b=1; for(i=2;i<=a/2;i++) if([input=type:blank,size:4][/input]) b+=i; [input=type:blank,size:4][/input]; for(i=2;i<=b/2;i++) if(b%i==0) c+=i; if([input=type:blank,size:4][/input]&&a!=b) printf("%d %d\n",a,b); } }
举一反三
- 下面程序的输出结果是[input=type:blank,size:4][/input]#include<stdio.h>void main(){int i,j,k=19;while(i=k-1){k-=3;if(k%5==0){i++;continue;}else if(k<5)break;i++;}printf("i=%d,k=%d\n",ik);}
- I[input=type:blank,size:4][/input]( send) her an invitation if I[input=type:blank,size:4][/input](find ) her address.
- 下面程序用于计算f,n)=1+2++n,其中power(m,n)求m”。请填写程序中相应语句。[br][/br]include <stdio.h>[br][/br]int power(int m,int n){[br][/br]int i;[br][/br][input=type:blank,size:4][/input];for(i=1;i<=n;i+)[br][/br][input=type:blank,size:4][/input];return p;}int f(int k,int n)[br][/br]{[br][/br]int i[br][/br][input=type:blank,size:4][/input];for(i=1;i<=n;i++)[br][/br][input=type:blank,size:4][/input];return s;}int main(void)[br][/br]{intk,n;[br][/br]scanf"%d%d",&k,&n);[br][/br]printf“f(%d,%d)-%ld”,k,n,fk,n);[br][/br]return 0;[br][/br]}[br][/br]
- 下列程序的功能是:求出数组X中各相邻两个元素的和依次存放到数组中,然后输出。请填空。int main(void[br][/br]{intx[10],a[9],i;[br][/br]for(i=0;i<10;i++)[br][/br]scanf("%d",&x[i]);for([input=type:blank,size:4][/input];i<10;i++)a[i-1]=x[i]+[input=type:blank,size:4][/input];for(i=0;i<9,i++)[br][/br]printf("%d ",a[i]);[br][/br]printf("\n");[br][/br]}
- 以下函数用以求[tex=0.571x0.786]FLCxr+5eRIYnIT0kyTRrXg==[/tex]的[tex=0.571x1.0]xmABzkfH1dI7hTnxCUH55g==[/tex]次方,请补充填空。double fun (double x,int y){int i; double z;for(i=1;i[input=type:blank,size:4][/input];i++)z=[input=type:blank,size:4][/input];return z;}