ksdf.net
当前位置:首页>>关于请编写函数fun(),它的功能是:求出1到1000之内能...的资料>>

请编写函数fun(),它的功能是:求出1到1000之内能...

void fun(int *a,int *n) { int i, j, k; *n = 0; for (i=1,j=1,k=1; i

#include int fun (int a[]){int index = 0;for (int k = 0 ; k < 1000 ; k++ ){if(k%7==0)if(k%11!=0)a[index++]=k;if(k%11==0)if(k%7!=0)a[index++]=k;}return index;}int main( ){ int aa[1000], n, k ; n = fun ( aa ) ; for ( k = 0 ; k < ...

#include int fun(int M, int a[]) { int n = 0; int i; for (i = 1; i < M; ++i) { if (i%7==0 ||i%11==0) { a[n] = i; n++; } } return n; } int main(void) { int n; int count; int a[100]; int i; printf("Input M:"); scanf(" %d", &n); c...

void fun(int *a,int n,int *k) { int i,j=0; *k=0; for(i=1;i

public class Test {public static void main(String[] args){for (Integer integer : fun()) {System.out.println(integer);}}public static List fun(){List list=new ArrayList();for (int i = 1; i < 1001; i++) {if(i%7==0||i%11==0)list.a...

int fun(int a,int b) {int m,i=0,n[80]; for(m=a;m<=b;m++) {if ((m/7==0&&m/11!=0)‖(m/7!=0&&m/11==0)) {n[i]=m; i++;} } printf(“%d”,i) }

#include #include void func(double *a,double *b) { double sum,cha; sum=*a+*b; cha=*a-*b; cout

function fun(byval w as integer) dim i,s as long for i=1 to len(w) s=s+val(mid(w,i,1))^2 next if s mod 5=0 then fun=1 else fun=0 end if end function

如图

分析: 1. 很简单的方法就是遍历,只要能被7整除和11整除又不被两者同时整除的数保存下来 2. 显然这个数要么是7的倍数要么是11的倍数且不是77的倍数实现: // 实现2方法public Integer[] getNums(){ List nums = new ArrayList(); // 遍历7的倍...

网站首页 | 网站地图
All rights reserved Powered by www.ksdf.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com