当前位置:Scooters

如何自定义函数并调用[拼音:yòng]

2025-02-24 08:25:53Scooters

c语言中怎么调用自定义函数?可以在main函数中定义如下:#include<stdio。H> void main(){intn1,N2 longa longsum(inta,intb)longfunctional(INTN)printf(“enter1andn2:”)scanf(\%d%

娱乐城

c语言中怎么调用自定义函数?

可以在main函数中定义如下:#include void main(){intn1,N2 longa longsum(inta,intb)longfunctional(INTN)printf(“enter1andn2:”)scanf(\%d%,d”,&n1,&n2)a=sum(N1,N2)printf(“a=%LD”,a)get()}longsum(inta,intb){longc1,C2 C1=factorial(a)/*N1将值传递给a,并调用函数factorial来查找数字的阶乘*/C2=factorial(b)/*N2将值传递给b,并调用函数factorial以获得数字的阶乘*/return(c1c2)/*将C1和C2的和返回给主函数*/}longfunctional(INTN){inti longgrtn=1 for(I=1I<=Ni)RTN*=I return(RTN);}

世界杯下注

本文链接:http://10.21taiyang.com/Scooters/1828881.html
如何自定义函数并调用[拼音:yòng]转载请注明出处来源