7£®º¯ÊýpiµÄ¹¦ÄÜÊǸù¾ÝÒÔϽüËƹ«Ê½Çó£ Öµ£º (£ ?£ )/6=1+1/(2?2)+1/(3?3)+?+1/(n?n)
ÏÖÔÚÇëÄãÔÚÏÂÃæµÄº¯ÊýÖÐÌî¿Õ£¬Íê³ÉÇó£ µÄ¹¦ÄÜ¡£ #include \double pi(long n)
{ double s=0.0; long i;
for(i=1;i<=n;i++)s=s+ ; return(sqrt(6*s)); }
8£®ÒÔϳÌÐòµÄÔËÐнá¹ûÊÇ ¡£ void fun(int x, int y, int z)
{ printf(\in:£¥d,£¥d,£¥d\\n\ y=x+5; z=x*y; x=zy;
printf(\end:£¥d, £¥d, £¥d\\n\ } main( )
{ int x=10,y=20,z=30; fun(z,y,x);
printf(\£¥d,£¥d,£¥d\\n\ }
9£®ÒÔϳÌÐòµÄÔËÐнá¹ûÊÇ ¡£ main( ) { int a=5; fun(a);
printf(\ }
fun(int k)
{ if(k>0) fun(k1); printf(\£¥d\ }
10£®ÒÔϳÌÐòµÄÔËÐнá¹ûÊÇ ¡£ int a=1; fun(int b)
{ static int a=5; a+=b;
printf(\£¥d\ return(a) ; } main( ) { int d=3;
printf(\£¥d\\n\ }
11. ÒÔϳÌÐòµÄ¹¦ÄÜÊǵ÷Óú¯Êýfun¼ÆË㣺m=1-2+3-4+¡+9-10£¬²¢Êä³ö½á¹û¡£ÇëÌî¿Õ¡£ int fun( int n) { int m=0, f=1, i; for(i=1; i<=n; i++) { m + = i * f;
f= ; } return m; }
main()
{ printf(\
12. ÒÔϳÌÐòÔËÐкóµÄÊä³ö½á¹ûÊÇ ¡¾12¡¿ ¡££ fun(int a)
£ £ { int b=0; static int c=3; £ £ b++;c++;
£ £ return(a+b+c);£ £ } £ £ main() £ £ { int i,a=5; £ £ for(i=0;i<3;i++) printf(\ %d\£ £ printf(\£ £ }
13. ÒÔϳÌÐòÔËÐкóµÄÊä³ö½á¹ûÊÇ ¡¾11¡¿£ £ void swap(int x,int y) £ £ { int t;
£ £ t=x; x=y; y=t; printf(\ %d \}
main() { int a=3, b=4; £ £ swap(a , b); printf(\ %d\£ }
14. ÒÔϺ¯ÊýµÄ¹¦ÄÜÊÇ£ºÇóxµÄy´Î·½£¬ÇëÌî¿Õ¡£ double fun( double x, int y) { int i;
double z;
for(i=1, z=x; i 15. ÉèÔÚÖ÷º¯ÊýÖÐÓÐÒÔ϶¨ÒåºÍº¯Êýµ÷ÓÃÓï¾ä£¬ÇÒfunº¯ÊýΪvoidÀàÐÍ£»Çëд³öfunº¯ÊýµÄÊײ¿ ¡£ÒªÇóÐβÎÃûΪb¡£ main() { double s[10]; int n; ©ª ©ª fun(s); ©ª } 16. º¯ÊýfunµÄ¹¦ÄÜÊÇ£ºÊ¹×Ö·û´®str°´ÄæÐò´æ·Å¡££¨2¼¶£© void fun (char str[]) { char m; int i, j; for (i=0, j=strlen(str); i< £¨1£© ; i++, j--) { m = str[i]; str[i] = £¨2£© str[j-1] = m; } printf(\} 17. ÒÔϳÌÐòµÄÔËÐнá¹ûÊÇ int a=5; int b=7; main( ) { int a=4, b=5,c; c=plus (a,b); printf(¡°A+B=%d\\n¡±,c) ; } plus (int x, int y) { int z; z=x+y; return (z); 18. ÒÔϳÌÐòµÄÊä³ö½á¹ûÊÇ void fun() { static int a=0; a+=2; printf(¡°%d¡±,a); } main() { int cc; for(cc=1;cc<4;cc++) fun() printf(¡°\\n¡±); } 19. ÒÔϳÌÐòµÄÊä³ö½á¹ûÊÇ #include static int b=0; a++; b++; ; ¡£ } ¡£ ¡£ printf(\} void main() { int i; for (i=1; i<=2; i++) f( i ); } 20. ÒÔϳÌÐòµÄÊä³ö½á¹ûÊÇ ¡£ #include increment(); increment(); } void increment(void) { static int x = 8; x ++; printf(\} 21 ÈôÓÐÒÔϳÌÐò£¬Ö´ÐкóÊä³ö½á¹ûÊÇ int f(int x,int y) { return£¨(y-x)*x£©; } main() { int a=3,b=4,c=5,d; d=f(f(3,4),f(3,5)); printf(\} 22. ÏÂÃæ³ÌÐòµÄÔËÐнá¹ûÊÇ£º func( int a) { int b=0,c=3; b++;c++; return(a+b+c);} main( ) { int a=2,i; for(i=0;i<3;i++) printf(¡°%d¡±,func(a)); } µÚ7Õ ¡£¡£