标题:请教问题,帮我查找下错误
取消只看楼主
冷月无痕
Rank: 2
等 级:论坛游民
帖 子:11
专家分:21
注 册:2011-6-8
结帖率:60%
已结贴  问题点数:18 回复次数:0 
请教问题,帮我查找下错误
编写n!的函数:
 #include<stdio.h>
 int fact(int i)
 {
   if (i<0)
    printf("error\n");
   else if (i==0!!i==1)
    fact(i)=1;
   else fact(i)=i*fact(i-1);
   return (fact);
 }
 main()
 {
  int i,j;
  printf("please input data:\n");
  scanf("%d",&i);
  j=fact(i);
  printf("the reslut is %d:",j);
  getch();
 }


错误 1111.c 6: If 语句缺少 ')'在 fact 函数中
错误 1111.c 8: 'else' 位置错在 fact 函数中
请教如何修改
搜索更多相关主题的帖子: include 
2011-08-05 18:43



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-346884-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.273836 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved