Nine array Fractions

Source: Internet
Author: User

1,2,3...9 These nine numbers make up a fraction with a value of exactly 1/3, how does the group method work?

The following program implements this function, please fill in the missing code in the underlined section.

#include <stdio.h>

void Test (int x[])

{

int a = x[0]*1000 + x[1]*100 + x[2]*10 + x[3];

int b = x[4]*10000 + x[5]*1000 + x[6]*100 + x[7]*10 + x[8];

if (a*3==b) printf ("%d/%d\n", A, b);

}

void f (int x[], int k)

{

int i,t;

if (k>=9) {

Test (x);

Return

}

for (i=k; i<9; i++) {

{t=x[k]; x[k]=x[i]; x[i]=t;}

f (x,k+1);

_____________________________________________//Fill in the blanks

}

}

int main ()

{

int x[] = {1,2,3,4,5,6,7,8,9};

f (x,0);

return 0;

}

Note: Fill in only what is missing, and do not write any existing code or descriptive text on any of the surfaces.

Nine array Fractions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.