找回密码
赶紧注册吧

QQ登录

只需一步,快速开始

当前位置: 交友网 > 技能必杀技 > 生活技能分享 >

(-1)^n如何用c语言表示

文章地址: http://www.tflove.com/jineng_sh/a20961.html
文章摘要:
#includestdio.h main() { int x, 蔚县 ,n; printf("input n:"); scanf("%d",n); if (n%2==0) x=1; else x=-1; } (-1)^n用c语言 须要包括数学库 #include math.h pow((-1),n) 源程序如下: #includestdio.h #includemath.h main() { int n,x; printf("input n:"); scanf("%d", 蓝田 ,n); x=pow((-
时间:2013-09-20 22:09来源:未知 作者:admin 点击: 次 《(-1)^n如何用c语言表示
#include<stdio.h>
main()
{
 int x,蔚县,n;
 ,蓬莱;printf("input n:");
 scanf("%d",n);
if (n%2==0)
  x=1;
else
 x=-1;
} ,蓬溪;
 (-1)^n用c语言
须要包括数学库
#include <math.h>
 pow((-1),n)
源程序如下:
#include<,蓬江;stdio.h>
#include<math.h>,蓬安;
main()
{
int n,x;
 printf("input n:");
 scanf("%d",蓝田,n);
x= pow((-1),n);
printf("x=%d",x);
}

(责任编辑:admin)
分享到: QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏0