1. 程式人生 > 其它 >XSS跨站指令碼

XSS跨站指令碼

1.輾轉相除法

先將兩個整數a與b進行相除,如果餘數為0(a%b==0),則b為兩數的最大公約數;如果不等於0,則將b賦值給a,將餘數賦值給b,在對a與b進行相除,直到餘數為0時終止(a%b==0),則b為最大公約數。

1 #include<stdio.h>
2 int main()
3 {
4 //方法二:輾轉相除法
5 int a, b, i;
6 printf("請輸入兩個整數:\n");
7 printf("a=");
8 scanf("%d", &a);
9 printf("b=");
10 scanf("%d", &b);


11 i = a % b;
12 while(i != 0)
13 {
14 a = b;
15 b = i;
16 i = a % b;
17 }
18 printf("%d",b);
19
20 return 0;
21 }
https://www.cnblogs.com/cuckoo-/p/10267614.html

2.虛擬碼

Write"Enter the integer a"
Read integera
Write"Enter the integer b"
Read integerb
Set remainder to integera REM integerb


WHILE(remainder is not zero)
Set integera to integerb
Set integerb to remainder
Set remainder to integera REM integerb
Write"The greatest common divisor is"
Write integerb