CÓïÑÔÁ·Ï°Ì⣨´øÏê½â´ð°¸£© ÏÂÔر¾ÎÄ

result =3 2.

#include

int min( int x, int y ) { int m£»

if ( x> y ) m = x£» else m = y£» return(m)£» £ý

main() {

int a=3,b=5,abmin £» abmin = min(a,b)£» printf(?min is %d?£¬ abmin)£» }

ÔËÐнá¹ûΪ£º min is 5 3.

#include func(int x) { x=10;

printf(?%d, ?,x); }

main( )

{ int x=20; func(x);

printf(?%d?, x); }

ÔËÐнá¹ûΪ£º 10, 20

ÔÚmainº¯ÊýÖе÷Óú¯Êýfunc£¬mainº¯Êý½«20×÷Ϊʵ²Î´©¸øfunc£¬²¢×ªÏò¿ªÊ¼Ö´ÐÐfunc.

main()¶ÔÓ¦µÄÄÚ´æ func£¨£©¶ÔÓ¦µÄÄÚ´æ 20 x 20 x func()Ö´ÐÐx=10;£¬ÆäÄÚ´æÖÐx±äΪ10.

10 x

func()Ö´ÐÐprintf(?%d, ?,x); ¼´Êä³öfuncº¯Êý¶ÔÓ¦ÄÚ´æÖÐxµÄÖµ£¬Êä³öµÄÊÇ10. ÖÁ´Ë£¬funcº¯ÊýÖ´ÐнáÊø£¬·µ»Ømainº¯Êý¡£

mainº¯ÊýÖ´ÐÐprintf(?%d?, x);´ËʱÊä³ömainº¯Êý¶ÔÓ¦ÄÚ´æÖеÄx£¬¼´20 4.

#include int m=4;

int func(int x,int y) { int m=1;

return(x*y-m); }

main()

{int a=2,b=3;

printf(\

printf(\}

ÔËÐнá¹ûΪ£º 4 1

ÕûÐͱäÁ¿mÔÚº¯ÊýÍⶨÒ壬Òò´ËmΪȫ¾Ö±äÁ¿£¬Æä×÷ÓÃÓÚ·¶Î§ÎªÆ䶨ÒåλÖÿªÊ¼£¬Ò»Ö±µ½Õû¸ö³ÌÐò½áÊø¡£Òò´ËfuncÓëmainº¯Êý¶¼¿ÉÒÔ·ÃÎÊm

³ÌÐòÊ×ÏÈÖ´ÐÐmainº¯Êý

Ö´ÐÐprintf(\¼´Êä³ömÖеÄÖµ4£¬²¢»»ÐС£

Ö´ÐÐprintf(\¼´Êä³ö±í´ïʽfunc(a,b)/mµÄÖµ£¬ÎªÁ˼ÆËã¸Ã±í´ïʽ£¬ ÐèÒªµ÷Óú¯Êýfunc¡£´Ëʱmain½«a,bÖеÄ2ºÍ3Öµ×÷Ϊʵ²Î´«µÝ¸øfuncµÄxºÍy ³ÌÐò¿ªÊ¼×ªÏòÖ´ÐÐfuncº¯Êý£¬´ËʱfuncÖеÄxΪ2£¬yΪ3

Ö´ÐÐint m=1; ´Ë¾ä¶¨ÒåÁËÒ»¸ö¾Ö²¿±äÁ¿m²¢¸³ÖµÎª1 ¡£mµÄ×÷ÓÃÓòΪÆäËùÔڵĸ´ºÏ

Óï¾ä£¬¼´funcµÄº¯ÊýÌ壬Òò´ËÔÚfuncµÄº¯ÊýÌåÖØ£¬ÓÐÏÞ·ÃÎʾֲ¿±äÁ¿m¡£ Ö´ÐÐreturn(x*y-m); ¼´return£¨2*3-1£© ;·µ»ØµÄÊÇÕûÊý5. funcº¯Êý·µ»ØÖÁmainº¯ÊýÖеı»µ÷Óô¦

mainº¯ÊýÖÐfunc(a,b)µÄֵΪ5£¬func(a,b)/m=5/4=1,×¢Ò⣬ÔÚmainº¯ÊýÖзÃÎʵÄmΪȫ¾Ö±äÁ¿m£¬´Ëʱmainº¯ÊýÎÞ·¨·ÃÎÊfuncÖеÄm£¬ÒòΪ²»ÔÚfuncÖÐmµÄ×÷ÓÃÓò¡£

5.

#include int fun(int a, int b) { if(a>b) return(a); else return(b); }

main()

{ int x=15, y=8, r; r= fun(x,y);

printf(\}

ÔËÐнá¹ûΪ£ºr=15

³ÌÐòÊ×ÏÈÖ´ÐÐmainº¯Êý

Ö´ÐÐr= fun(x,y);¼´½«func(x,y)µÄÖµ¸³¸ør£¬ÎªÁ˼ÆËã¸Ã±í´ïʽ£¬ÐèÒªµ÷Óú¯Êýfunc¡£´Ëʱmain½«x,yÖеÄ15ºÍ8Öµ×÷Ϊʵ²Î´«µÝ¸øfuncµÄaºÍb ³ÌÐò¿ªÊ¼×ªÏòÖ´ÐÐfuncº¯Êý£¬´ËʱfuncÖеÄaΪ15£¬bΪ8

Ö´ÐÐifÓï¾ä;ÅжÏifºóÃæµÄ±í´ïʽ£¬a>b³ÉÁ¢£¬Òò´ËÖ´ÐÐÏàÓ¦µÄ²Ù×÷return(a)£»¼´·µ»Ø aµÄÖµ ¡£

funcº¯Êý·µ»ØÖÁmainº¯ÊýÖеı»µ÷Óô¦

mainº¯ÊýÖÐfunc(x,y)µÄֵΪ15£¬¼´½«15¸³¸ør¡£ Ö´ÐÐprintf(\¼´Êä³ör=15 6.

#include int fac(int n) { int f=1,i;

for(i=1;i<=n;i++)

f=f * i; return(f); }

main()

{ int j,s;

scanf(?%d?,&j); s=fac(j);

printf(\}

Èç¹û´Ó¼üÅÌÊäÈë3£¬ ÔËÐнá¹ûΪ£º 3!=6

³ÌÐòÊ×ÏÈÖ´ÐÐmainº¯Êý

Ö´ÐÐr= fun(x,y);¼´½«func(x,y)µÄÖµ¸³¸ør£¬ÎªÁ˼ÆËã¸Ã±í´ïʽ£¬ÐèÒªµ÷Óú¯Êýfunc¡£´Ëʱmain½«x,yÖеÄ15ºÍ8Öµ×÷Ϊʵ²Î´«µÝ¸øfuncµÄaºÍb ³ÌÐò¿ªÊ¼×ªÏòÖ´ÐÐfuncº¯Êý£¬´ËʱfuncÖеÄaΪ15£¬bΪ8

Ö´ÐÐifÓï¾ä;ÅжÏifºóÃæµÄ±í´ïʽ£¬a>b³ÉÁ¢£¬Òò´ËÖ´ÐÐÏàÓ¦µÄ²Ù×÷return(a)£»¼´·µ»Ø aµÄÖµ ¡£

funcº¯Êý·µ»ØÖÁmainº¯ÊýÖеı»µ÷Óô¦

mainº¯ÊýÖÐfunc(x,y)µÄֵΪ15£¬¼´½«15¸³¸ør¡£ Ö´ÐÐprintf(\¼´Êä³ör=15 7.

#include

unsigned fun6(unsigned num) { unsigned k=1;

do

{ k*=num; num/=10; }while(num); return k; }

main()

{ unsigned n=26;

printf(?%d\\n?,fun6(n)); }

ÔËÐнá¹ûΪ£º12

³ÌÐòÊ×ÏÈÖ´ÐÐmainº¯Êý

Ö´ÐÐprintf(?%d\\n?,fun6(n)); ¼´Êä³ö±í´ïʽfunc(6)µÄÖµ£¬ÎªÁ˼ÆËã¸Ã±í´ïʽ£¬ÐèÒªµ÷Óà º¯Êýfunc¡£´Ëʱmain½«nÖеÄ26×÷Ϊʵ²Î´«µÝ¸øfuncµÄnum ³ÌÐò¿ªÊ¼×ªÏòÖ´ÐÐfuncº¯Êý£¬´ËʱfuncÖеÄnumΪ26 Ö´ÐÐdo-whileÓï¾ä

µÚ1´ÎÑ­»·

Ö´ÐÐk*=num,¼´k=k*(num)=1*(26)=6

Ö´ÐÐnum/=10;¼´num=num/10=26/10=2

whileºóÃæÑ­»·Ìõ¼þΪnum,´ËʱnumΪ2£¬ÊÇ·Ç0Öµ£¬¼´±íʾѭ»·Ìõ¼þ³ÉÁ¢£¬ ¼ÌÐøÖ´ÐÐÑ­»·Ìå¡£´ËʱkΪ6 µÚ2´ÎÑ­»·

Ö´ÐÐk*=num,¼´k=k*(num)=6*(2)=12 Ö´ÐÐnum/=10;¼´num=num/10=2/10=0

whileºóÃæÑ­»·Ìõ¼þΪnum,´ËʱnumΪ0£¬±íʾѭ»·Ìõ¼þ²»³ÉÁ¢£¬ ½áÊøÑ­»·

Ö´ÐÐreturn k; ¼´·µ»ØÖÁmainº¯ÊýÖеı»µ÷Óô¦ Ö´ÐÐmainº¯Êý

¼ÌÐøÖ´ÐÐprintf(?%d\\n?,fun6(n)); ¼´Êä³ö12 8.

#include

int max(int x, int y); main()

{ int a,b,c;