討論串[問題]最大公因數
共 5 篇文章
內容預覽:
#include <stdio.h>. #include <stdlib.h>. int f(int a,int b){. int i,ans;. for(i=1;i<=a;i++){. if(a%i==0&&b%i==0). ans=i;}. printf("%d",ans);. }. int m
(還有378個字)
內容預覽:
orz...看起來我寫法好像比較不一樣說. Code:. #include <iostream>. using namespace std;. int GCF(int a, int b);. int main(). {. cout << "請輸入兩個正整數: ";. int a, b;. cin >
(還有304個字)
內容預覽:
這樣比較簡潔XD. #include<iostream>. #include<algorithm>. using namespace std;. int main(). {. int a, b; //歐不 剛剛忘記加了 Q Q. printf("輸入兩個數求最大公因數\n請輸入第一個正整數:");.
(還有179個字)
內容預覽:
http://nopaste.csie.org/34aae. 稍微改了一下,這樣比較好看,不過我沒寫註解@@. 要寫註解比較好. #include<stdio.h>. #include<stdlib.h>. int main(int argc,char *argv[]). {. int One,Tw
(還有761個字)
內容預覽:
#include<stdio.h>. #include<stdlib.h>. main(). {. int a,b,q,r,t;. printf("請給我兩個正整數:");. scanf("%d %d",&a,&b);. if(a<=0||b<=0). {printf("請重新輸入~~~");}.
(還有319個字)