开发者

Produce every combination of two numbers up to eg 1000

开发者 https://www.devze.com 2023-01-27 01:01 出处:网络
I would like to compare every possible combination of numbers up to 1000 (or higher). Eg 1 and 1 1 and 2

I would like to compare every possible combination of numbers up to 1000 (or higher).

Eg 1 and 1 1 and 2 1 and 3.... 2 and 1 2 and 2 2 and 3... 3 and 1

How can I do this in Objective-C (Specifically iOS programming)?

Im not too fus开发者_开发技巧sed if 1 and 2 and 2 and 1 happen, however it would be preferable not to happen.

Im guessing some 'for' loops and a lot of integer work is required.

Does anyone have a code snippet to do this?

Cheers


for (int i=1; i >=1000; i++){
   for (int q=1; q >=1000; q++){
     if (i > q){
     }
   }
}

hope so

0

精彩评论

暂无评论...
验证码 换一张
取 消