總網頁瀏覽量

2017年5月26日 星期五

水仙花數

輸入n值,可找出比 n 小的水仙花數

測試過可找到第31個水仙花數:912985153

水仙花數定義:http://ppt.cc/ilfHa

有趣的名稱~~~~~
一位自冪數:獨身數
兩位自冪數:沒有
三位自冪數:水仙花數
四位自冪數:四葉玫瑰數
五位自冪數:五角星數
六位自冪數:六合數
七位自冪數:北斗七星數
八位自冪數:八仙數
九位自冪數:九九重陽數
十位自冪數:十全十美數


執行檔
https://drive.google.com/file/d/0B03tzGyNUd6RRVI5OTVtVlY3Yjg/view?usp=sharing

程式檔
https://drive.google.com/file/d/0B03tzGyNUd6ReUpaUjhONHFWak0/view?usp=sharing


2017.5.26

泡沫排序法

@@ 可將輸入的數由小到大排列 @@

執行檔

程式檔


2017.5.27

2017年5月25日 星期四

2017年5月17日 星期三

解二、三次方程式

輸入三次方程式 ax^3+bx^2+cx+d=0 的係數 a,b,c,d 即可找出三個解,但若輸入的 a=0,則變成二次方程式,依舊可以求解。


撰寫想法:
依虛根成對定理知三次方程式必有一個實根,用牛頓法找出其中一個後,再做因式分解,變成二次方程式後,代公式求解。

2017年5月11日 星期四

海龍公式

輸入三角形的三邊長,可判斷是否可構成三角形,若是,可得三角形面積…

執行檔: https://drive.google.com/file/d/0B03tzGyNUd6RdFZCUDZKUVZ2Qk0/view?usp=sharing

程式碼:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define area(s,a,b,c) (double)s*(s-a)*(s-b)*(s-c)
int main(int argc, char** argv)
 {
float a,b,c;
printf(" Please input the sides of the triangle ==>");
scanf("%f  %f  %f",&a,&b,&c);
if((area(0.5*(a+b+c),a,b,c))<=0)
printf("It is not a triangle\n");
else
printf("Area of triangle = %f\n",pow(area(0.5*(a+b+c),a,b,c),0.5));
system("pause");
return 0;
}


大階乘計算

經由此程式,可算出 100! 的值,甚至更大…

執行檔:
https://drive.google.com/file/d/0B03tzGyNUd6RdFZaMFhpVkswTTQ/view?usp=sharing

程式碼:
https://drive.google.com/file/d/0B03tzGyNUd6ReEZyN205NWk3cW8/view?usp=sharing