摘要:
#include int main(void){ int n; int factorial(int n); scanf_s("%d",&n); printf("%d\n",factorial(n)); return 0;}int factorial(int n){ int i,fact=1; for(i=1;i<=n;i++) fact=fact*i; return fact;} 阅读全文
摘要:
#include#includeint IsPrime(int a){ int i; for (i=2;i <= sqrt(a); i++) if (a%i == 0) return 0; return 1; int main(){ int a; printf("请输入一个正整数a:"); scanf("%d",&a); if (IsPrime(a)) printf("%d是一个质数\n",a); else printf("%d不是一个质数\n",a);} 阅读全文
摘要:
#includeint main(){ int i; long m; float f; double d; printf("sizeof(int)=%d,sizeof(i)=%d,&i=%x\n",sizeof(int),sizeof(i),&i); printf("sizeof(long)=%d,sizeof(m)=%d,&m=%x\n",sizeof(long),sizeof(m),&m); printf("sizeof(float)=%d,sizeof(f)=%d,&f=%x\n",siz 阅读全文
摘要:
#include int main(void){ int x,y; printf("请输入x的值: "); scanf_s("%d",&x); y=x*x; printf("%d=%d*%d\n",y,x,x); printf("%d*%d=%d\n",x,x,y); return 0;} 阅读全文