a至电源b程序 [英] a to the power b programm

查看:119
本文介绍了a至电源b程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


请提供给我c#中a ^ b程序的代码(当b为+ ve和-ve时)

解决方案

从此处开始:System.Math类 [ 解决方案

Start here: System.Math Class[^]


Just pass a and b to this function. This function will return the answer,

intAns = fnResult(2,3)

Function fnResult(Byval a as integer, Byval b as integer) as integer
Dim intAns as integer = 1

For i as integer=0 to b-1
  intAns = intAns * a
Next

return intAns 
End Function


这篇关于a至电源b程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆