用vb編寫函式fun函式的功能是求四位數的各

2022-02-24 19:36:39 字數 1641 閱讀 7755

1樓:殘玉潭秋

可以在excel表中的a1**中填寫"1234",在b1**中填寫"power(mid(a1,1,1),3)+power(mid(a1,2,1),3)+power(mid(a1,3,1),3)+power(mid(a1,4,1),3)"

這樣就可以得到你想要的值,呵呵

注意以上的**中填寫的雙引號不要加進去哦。

2樓:

function lifanghe(num as integer)

lifanghe=val(mid(num,1,1))^3+val(mid(num,2,1))^3+val(mid(num,3,1))^3+val(mid(num,4,1))^3

end function

3樓:孛能束晏

private function fun(n as integer) as integer

fun = 0

dim i as integer

for i = 2 to n / 2

if n mod i = 0 then fun = fun + inext i

end function

用vb編寫:找出所有的「水仙花數」。 「水仙花數」是指一個三位數,其各位數字的立方和等於該數本身

4樓:livingroom寶貝

private sub command1_click()dim a%, b%, c as integerfor a = 1 to 9

b = 0

do while b <= 9

c = 0

do until c > 9

if a ^ 3 + b ^ 3 + c ^ 3 = 100 * a + 10 * b + c then

print "水仙花數"; 100 * a + 10 * b + cend if

c = c + 1

loop

b = b + 1

loop

next a

end sub

我的文庫有好多呢。

我的輸出與題目有些出入。

5樓:

private sub form_load()show

print vbcrlf;

print vbcrlf;

dim a as integer, b, cfor i = 100 to 999

a = i \ 100

b = (i mod 100) \ 10

c = i mod 10

if (a ^ 3 + b ^ 3 + c ^ 3 = i) then

print tab(10); i & "=" & a & "^3+" & b & "^3+" & c & "^3"

end if

next i

end sub

c語言,編寫一函式,其功能是求一個長整數各位數字之和。要求使用指標函式實現

6樓:育知同創教育

其功能來是求一個長自

整數各位數字之和:

int function(long l)

return sum;}

編寫fun函式函式的功能是計算,編寫一個fun函式,函式的功能是計算1 2 n

include int main printf the result is d n sum return 0 執行結果如下專 屬 編寫函式fun s 1 1 1 2 1 1 2 3 1 1 2 3 n include include float fun int n return s main 編寫函...

2編寫函式fun,然後設計主函式呼叫函式fun。函式fun的功能是 計算正整數num的各位上的數字之積

int fun int n,int m return sum include void main h fun n,m printf d n h 經過tc和vc 執行後 dao均可出來專正確結屬果 include include int fun int x return r main 1 includ...

3程式設計題請編寫函式fun其功能是計算並輸

printf f f n n f out fopen outfile.dat w c語言是函數語言程式設計語言嗎 c語言支援函式遞迴呼叫,支援高階函式 函式指標 支援不可變數 const關鍵字 支援模式匹配 但不是函數語言程式設計語言 不是,c是指令式程式設計語言。c語言中有沒有求絕對值的函式啊?謝...