최대 공약수

2910 단어 xml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" fontSize="12" fontFamily="Georgia">
	<mx:Script>
		<![CDATA[
			import mx.controls.TextArea;

			private function gongyueshu(txt1:String, txt2:String):String
			{
				var a1:int=parseInt(txt1);
				var a2:int=parseInt(txt2);
				//trace(a1);
				var a:int=Math.max(a1, a2);
				var b:int=Math.min(a1, a2);
				var r:int=1;
				// :%     
				while (r > 0)
				{
					r=a % b;
					a=b;
					b=r;
				}

				var res:String=a.toString();

				return res
			}
		]]>
	</mx:Script>
	<mx:Panel title="       " width="394" height="351" horizontalAlign="center" layout="vertical" fontFamily="Verdana" fontSize="14">
		<mx:HBox width="362" height="100%">
			<mx:ApplicationControlBar dock="true" width="100%" height="100%" fillAlphas="[1.0, 1.0]" fillColors="[#F5F9E2, #F3FCCC]">
				<mx:VBox height="257" width="220" fontSize="14" themeColor="#05578B" backgroundAlpha="0.0" borderColor="#F8F8F8" borderStyle="solid" borderThickness="0" fontFamily="Times New Roman">
					<mx:Label text="  1" width="100" color="#3C130B" alpha="1.0"/>
					<mx:TextArea text="1" textAlign="right" id="text1" height="29" width="100" change="text3.text=gongyueshu(text1.text,text2.text)"/>
					<mx:Label text="  2" width="100"/>
					<mx:TextArea text="2" textAlign="right" id="text2" height="28" width="100" change="text3.text=gongyueshu(text1.text,text2.text)"/>
					<mx:Label text="  " width="100"/>
					<mx:TextArea text="3" textAlign="right" id="text3" height="28" width="100" borderColor="#000406" themeColor="#85C3EA" color="#F7C8C4" backgroundColor="#0A092A"/>
					<mx:HRule width="202" height="0" strokeColor="#0E0C70"/>
					<mx:Button label="  1、2      " click="text3.text=gongyueshu(text1.text,text2.text)" textAlign="center" width="200" id="button2" fontWeight="normal"/>
				</mx:VBox>
			</mx:ApplicationControlBar>
		</mx:HBox>
	</mx:Panel>
</mx:Application>


좋은 웹페이지 즐겨찾기