一道C题目

 1 #include <stdio.h>
 2 #include <math.h>
 3 
 4 int main()
 5 {
 6     long int sum;
 7     long int a,b;
 8     int ka = 0,kb,i,j;
 9     printf("Enter sum:\n");
10     scanf("%ld",&sum);
11     for(a = 100; a <= sum; a++)
12     {
13         b = sum -a;
14         if(b < 100)
15         {
16             return 0;
17         }
18         ka = (long int)sqrt(a);
19         kb = (long int)sqrt(b);
20         i = 100 > ka ? 100 : ka;
21         for(; i <= a; i++)
22         {
23             if(a%i == 0)
24             {
25                 j = 100 > kb ? 100 : kb;
26                 for(; j <= b; j++)
27                 {
28                     if(b%j == 0)
29                     {
30                         printf("m = %d,n = %d,x = %d,y = %d\n",b/j,a/i,j,i);
31                     }
32                 }
33             }
34         }
35     }
36     
37     return 0;    
38 }
posted @ 2012-08-10 20:13  常伟华  阅读(316)  评论(0编辑  收藏  举报