我是ios編程的新手。我有關於GCD計劃的問題。最大公約數Objective-C
01 // This program finds the greatest common divisor of two nonnegative integer values
02
03 #import <Foundation/Foundation.h>
04
05 int main (int argc, const char * argv[]) {
06 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
07 unsigned int u, v, temp;
08
09 NSLog(@"Please type in two nonnegative integers.");
10 scanf("%u%u", &u, &v);
11
12 while (v != 0) {
13 temp = u % v;
14 u = v;
15 v = temp;
16 }
17
18 NSLog(@"Their greatest common divisor is %u", u);
19
20 [pool drain];
21 return 0;
22 }
我不明白這個部分:
while(v!=0)
temp = u%v
u =v;
v = temp;
這是什麼意思,在英語?
謝謝。非常有幫助 – Ben