![](http://images0.cnblogs.com/blog/569975/201310/01175503-c0aa59ba39ac4d22b935080f3e341619.jpg)
![](http://images0.cnblogs.com/blog/569975/201310/01175329-622c080acc4345b4b3dcbfc8f5d6175b.jpg)
![](http://images0.cnblogs.com/blog/569975/201310/01175047-f09529f8d15f434daea4733f3b36450d.jpg)
![](http://images0.cnblogs.com/blog/569975/201310/01174850-22c7e3554e1b48ecace7293c50367298.jpg)
#include<stdio.h> int main(void) { int x,y; printf("请输入x的值:"); scanf("%d",&x); y=x*x; printf("%d=%d*%d\n",y,x,x); printf("%d*%d=%d\n",x,x,y); return 0; }
#include<stdio.h> #include<math.h> int main() { int a,i; printf("请输入一个正数a:"); scanf("%d",&a); for(i=2;i<=sqrt(a);i++) if(a%i==0)break; if(i<sqrt(a))printf("%d不是一个质数\n",a); else printf("%d是一个质数\n",a); }
#include<stdio.h> #include<math.h> int 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); }
#include<stdio.h> int 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",sizeof(float),sizeof(f),&f); printf("sizeof(double)=%d,sizeof(d)=%d,&d=%x\n",sizeof(double),sizeof(d),&d); }