ʵÑéÈý C»ù±¾Êý¾ÝÀàÐͼ°ÔËËã
1. ±à³Ì£º¸ù¾ÝÐèÒª¶¨ÒåÏà¹Ø±äÁ¿£¬¼üÅÌÊäÈë10.0¡¢20.6¡¢5.0Èý¸öʵÊý·Ö±ð¸³¸øÏà¹ØÈý¸ö±äÁ¿£¬Êä³ö¸Ã3¸ö±äÁ¿µÄºÍs¡¢³Ë»ýpºÍƽ¾ùÖµa¡£
2. ±à³Ì£ºÊäÈëÇòµÄ°ë¾¶£¬¼ÆËãÇòÌå±íÃæ»ýºÍÇòÌå»ý¡£
3. ±à³Ì£º¶¨Òå6¸ö±äÁ¿£¬Í¨¹ý¼üÅ̽«¡°10£¬ £10£¬ 40000£¬ a£¬ 3.14£¬ hello¡±ÕâÁù¸öÖµ·Ö±ð¸³¸øÏàÓ¦±äÁ¿£¬È»ºóÔÚÆÁÄ»ÉÏÊä³ö±äÁ¿µÄÖµ£¨Ã¿ÐÐÊä³öÒ»¸ö±äÁ¿£©¡£
4. ±à³Ì£º´Ó¼üÅ̽ÓÊÕ1¸ö×Ö·û¸ø±äÁ¿s1£¬1¸ö×Ö·û´®£¨ÔÊÐí´øÓпոñ£©¸ø×Ö·ûÊý×és2£¬Êä³ö×Ö·û±äÁ¿s1µÄASCIIÂëÖµ¼°×Ö·ûÊý×és2ÖеÄ×Ö·û´®¡£
5. ±à³Ì£º´Ó¼üÅÌÊäÈë¶þ¸öÕûÊý·Ö±ð¸³¸øÕûÐͱäÁ¿a¡¢b£¬½«ËüÃÇ°´ÓÉСµ½´óµÄ˳ÐòÊä³ö¡£ 6. ±à³Ì£ºµ÷Óñê×¼¿âº¯Êýsin£¨x£©¼ÆËã6800µÄÕýÏÒÖµ£¨´ËÌâΪѡ×ö£©¡£
7. ±à³Ì£º¼üÅÌÊäÈëÒ»¸öʵÊý¸³¸ø±äÁ¿x£¬¼ÆËã y=x*x*x+x*x+x µÄÖµ£¬·Ö±ðÊä³öyÖµ¡¢yÖµµÄÕûÊý²¿·ÖºÍСÊý²¿·Ö£¨´ËÌâΪѡ×ö£©¡£
8. ±à³Ì£º¼üÅÌÊäÈëËĸöÕûÊý·Ö±ð¸³¸øÕûÐͱäÁ¿a¡¢b¡¢c¡¢d£¬ÓÃÈýÄ¿ÔËËã·½·¨½«ËüÃÇ°´ÓÉ´óµ½Ð¡µÄ˳ÐòÊä³ö£¨´ËÌâΪѡ×ö£©¡£ 1. #include
{float x,y,z,s,p,a;
scanf(\s=x+y+z; p=x*y*z; a=s/3;
printf(\}
2. #include
3. #include
main()
{int a,b;long c;char d,st[6];float e; scanf(\
printf(\}
4. #include
{ char s1,s2[6]; scanf(\printf(\}
5. #include
scanf(\if (a
printf(\else
printf(\}
6. #include
7. #include
{float x,y,b;int a; scanf(\y=x*x*x+x*x+x; a=(int)y; b=y-a;
printf(\}
ʵÑéËÄ C·ÖÖ§½á¹¹³ÌÐòÉè¼Æ
1. ±à³Ì£º´Ó¼üÅÌÊäÈëÒ»¸ö×Ö·û£¬ÈçÊÇ´óд×Öĸ£¬ÔòÊä³öÏàӦСд×Öĸ£»ÈçÊÇСд×Öĸ£¬ÔòÔÑùÊä³ö£»ÆäËü×Ö·ûÊä³ö¡°Not letter!¡±¡£
2. ±à³Ì£ºÅжÏÊäÈëµÄÕýÕûÊýÊÇ·ñ¼ÈÊÇ3ÓÖÊÇ5µÄÕûÊý±¶¡£ÈôÊÇ£¬Êä³öYes,·ñÔòÊä³öNo¡£ 3. ±à³Ì£º´Ó¼üÅÌÊäÈëÈý¸öÕûÊý£¬·Ö±ð¸³¸ø±äÁ¿a£¬b£¬c£¬Êä³öÆäÖеÄ×î´óÖµ£¨ÒªÇ󲻸ıäa¡¢b¡¢cµÄÖµ£©¡£
4. ±à³Ì£ºÓÃscanfÊäÈëÈÎÒâÁ½¸öÊý·Ö±ð¸³¸ø±äÁ¿a¡¢b£¬Èôa´óÓÚµÈÓÚb£¬ÔòÖ±½ÓÊä³öa¡¢b£¬·ñÔò½«a¡¢bµÄÖµ½»»»£¨¼´aµÄÔÖµ·ÅÈëbÖУ¬bµÄÔÖµ·ÅÈëaÖУ©ºóÔÙÊä³ö¡£
5. ±à³Ì£ºÊäÈëÕûÊýaºÍb£¬Èôa+ b´óÓÚ100£¬ÔòÊä³öa+ b°ÙλÒÔÉϵÄÊý×Ö£¬·ñÔòÊä³öÁ½ÊýÖ®ºÍ¡£
6. ±à³Ì£º´Ó¼üÅÌÊäÈëÈý¸öÕûÊý£¬·Ö±ð¸³¸ø±äÁ¿a£¬b£¬c£¬Çë°´´ÓСµ½´óµÄ˳ÐòÒÀ´ÎÊä³öa¡¢b¡¢c£¨ÒªÇ󲻸ıäa¡¢b¡¢cµÄÖµ£©¡£
7. ±à³Ì£º´Ó¼üÅÌÊäÈëÈý¸öÕûÊý£¬·Ö±ð¸³¸ø±äÁ¿a£¬b£¬c£¬Çë°´´ÓСµ½´óµÄ˳ÐòÒÀ´Î½«ÕâÈý¸öÊý´æ·ÅÓÚa¡¢b¡¢cÖУ¬×îºóÊä³öa¡¢b¡¢c¡£
8. ±à³Ì£ºÓÉϵͳÉú³ÉÒ»¸ö10ÒÔÄÚµÄËæ»úÕûÊý£¬Óû§´Ó¼üÅÌÉÏÊäÈëÒ»¸ö10ÒÔÄÚµÄÕûÊý£¬Èç¹ûÁ½ÕßÏàµÈÊä³ö¡°OK¡±£¬·ñÔòÊä³ö¡°ERROR¡±¡£
×¢£ºËæ»úÊýµÄÉú³É±ØÐë°üº¬Í·Îļþ#include
scanf(\if(x>='a'&&x<='z') printf(\
else if (x>='A'&&x<='Z') printf(\
else printf(\}
2. #include
scanf(\if (x>0)
{ if(x%3==0&&x%5==0) printf(\
else printf(\else printf(\}
3. #include
{int a,b,c,max;
scanf(\max=a>b?a:b;
2
2
2
2
max=max>c?max:c;
printf(\}
4. #include
{float a,b;
scanf(\if(a
printf(\} 5.
#include
{int a,b,t,r,s;
scanf(\s=a+b;
r=a*a+b*b; t=r/100; if(r>100)
printf(\
else printf(\} 6.
#include
{int a,b,c,d,max,min;
scanf(\if(a>=b) {max=a;
min=b;} else {max=b; min=a;} if(c>=max) max=c;
if(c<=min) min=c;
d=a+b+c-min-max;
printf(\} 7.
#include
{ int a, b, c, d;
scanf(\ if(a>=b) {d = a; a = b; b = d;} else if(b>=c) { d = b; b = c; c = d; }
printf(\}
8.
#include
srand((unsigned)time(NULL)); b=rand()+1; scanf(\
printf(\Ëæ»úÊýb=%d\\n\if(a==b)
printf(\
else printf(\}
ʵÑéÎå C¶à·ÖÖ§½á¹¹³ÌÐòÉè¼Æ*
1. ±à³Ì£º¼ÆË㽱ѧ½ðssµÄÖµ£¬ÒÑÖª½±Ñ§½ðssÓë³É¼¨sµÄ¹ØϵΪ£º
¾ßÌåÒªÇó£º
£¨1£©Óà if Óï¾äʵÏÖ·ÖÖ§½á¹¹µÄ±à³Ì¡£ £¨2£©sΪÕûÐÍ£¬ssÒªÇó¾«È·µ½Ð¡Êýµãºó¶þλ¡£ £¨3£©ÓÃscanfº¯Êý¸øs¸³Öµ£¬ÇÒÊäÈëÇ°ÓÐÏàÓ¦Ìáʾ¡£ £¨4£©½á¹ûÊä³öʱ²ÉÓÃÒÔÏÂÐÎʽ£º
³É¼¨s£½¾ßÌåÖµ£¬½±Ñ§½ðss=¾ßÌåÖµ 2. É躯Êýf(x)ÈçÏ£¬Çóº¯Êýº¯Êý·¨f(x)µÄÖµ¡£
¾ßÌåÒªÇó£º
£¨1£©ÓÃÌõ¼þ±í´ïʽ±à³Ì¡£ £¨2£©ÓÃifÓï¾ä±à³Ì¡£
£¨3£©ÓÃscanfº¯Êý¸ø×Ô±äÁ¿¸³Öµ£¬ÇÒÊäÈëÇ°ÓÐÏàÓ¦Ìáʾ¡£ £¨4£©½á¹ûÊä³öʱ²ÉÓÃÒÔÏÂÐÎʽ£º x£½¾ßÌåÖµ£¬f(x)=¾ßÌåÖµ £¨5£©¸ø³öÄãËùʹÓõIJâÊÔÓÃÀý¡£ Ìáʾ£º
°´CµÄÓï·¨¹æÔò£¬±êʶ·ûÓÉ×Öĸ¡¢Êý×Ö¡¢Ï»®Ïß×é³É£¬²»Äܽ«f(x)×÷Ϊ±äÁ¿Ãû£¬±¾ÌâÖУ¬º¯ÊýÃû¿ÉÆðΪ f »ò y µÈ¡£µ«×÷Ϊ·Ç¸ñʽ¿ØÖÆ×Ö·û£¬f(x)ÍêÈ«¿ÉÒÔ³öÏÖÔÚprintfº¯ÊýµÄË«ÒýºÅÄÚ¡£
3. ±à³Ì£ºÊäÈëÒ»¸öÕûÊý£¬ÅжÏËüÄÜ·ñ±»3£¬5£¬7Õû³ý£¬²¢Êä³öÒÔÏÂÐÅÏ¢Ö®Ò»£º £¨1£©ÄÜͬʱ±»3£¬5£¬7Õû³ý¡£
£¨2£©Äܱ»ÆäÖÐÁ½ÊýÕû³ý£¨Ö¸³öÊÇÄÄÁ½¸öÊý£©¡£ £¨3£©Äܱ»ÆäÖÐÒ»¸öÊý£¨Ö¸³öÊÇÄÄÒ»¸öÊý£©Õû³ý¡£ £¨4£©²»Äܱ»3£¬5£¬7ÈÎÒ»¸öÊýÕû³ý¡£
4. ±à³Ì£ºÓÃswitch Óï¾ä±àдһ¸ö¼òµ¥µÄ¼ÆËãÆ÷³ÌÐò£¬ÊäÈë¸ñʽΪ£ºdata1 op data2¡£ÆäÖÐdata1ºÍdata2Ϊ²Î¼ÓÔËËãµÄÁ½¸öÊý£»opΪÔËËã·û£¬È¡ÖµÖ»ÄÜÊÇ+¡¢-¡¢*¡¢/¡£ 5. ±à³Ì£º¼ÆËãÄãµÄ³öÉúÈÕÆÚÊÇÐÇÆÚ¼¸¡£
£¨1£©Í¨¹ý¼üÅÌÊäÈëÄã³öÉúÄÇÒ»ÄêµÄÔªµ©ÊÇÐÇÆÚ¼¸ £¨2£©Í¨¹ý¼üÅÌÊäÈëÄãµÄ³öÉúÈÕÆÚ £¨3£©Êä³ö½á¹û 1.
#include
{int s; float ss;
printf(\scanf(\if(s<0||s>100) printf(\else {if(s>=0&&s<80) ss=0;
else if(s>=80&&s<90) ss=100+s;
else if(s>=90&&s<=100) } } 2.
#include
{float x;int f;
printf(\scanf(\if(x==0) f=0; else f=(x>0)?1:-1;
printf(\} 3.
#include
ss=200+s*3/2;
printf(\³É¼¨s=%d,½±Ñ§½ðss=%0.2f\\n\
{int x,a,b,c;
printf(\ÇëÊäÈëÒ»¸öÕûÊýx\scanf(\a=x%3; b=x%5; c=x%7;
if(a==0&&b==0&&c==0)
printf(\ÄÜͬʱ±»3,5,7Õû³ý\\n\
else if(a==0 && b==0) printf(\Äܱ»3,5Õû³ý\\n\£¬x); else if(a==0 && c==0) printf(\Äܱ»3,7Õû³ý\\n\ } 4.
#include
printf(\ÇëÊäÈëËãʽ\scanf(\switch(op)
{case '+': printf(\ case '-': printf(\ case '*': printf(\ case '/': printf(\ } } 5.
#include
int x,m,d;
printf(\ÇëÊäÈëÄã³öÉúÄÇÄêÔªµ©µÄÐÇÆÚ£¨1ÖÁ7£©£º\\n\printf(\ÇëÊäÈëÄãµÄ³öÉúÈÕÆÚ £¨mm/dd£© £º \\n\scanf(\switch ((m*30+d)/7)
{case 0:printf(\Äã³öÉúÄÇÌìΪÐÇÆÚ%d\case 1:printf(\Äã³öÉúÄÇÌìΪÐÇÆÚ%d\case 2:printf(\Äã³öÉúÄÇÌìΪÐÇÆÚ%d\case 3:printf(\Äã³öÉúÄÇÌìΪÐÇÆÚ%d\case 4:printf(\Äã³öÉúÄÇÌìΪÐÇÆÚ%d\
else if(b==0 && c==0) printf(\Äܱ»5£¬7Õû³ý\\n\
else if(a==0) printf(\Äܱ»3Õû³ý\\n\
else if(b==0) printf(\Äܱ»5Õû³ý\\n\
else if(c==0) printf(\Äܱ»7Õû³ý\\n\£¬x);
else printf(\²»Äܱ»3,5,7ÈÎÒâÒ»¸öÊýÕû³ý\\n\
case 5:printf(\Äã³öÉúÄÇÌìΪÐÇÆÚ%d\case 6:printf(\Äã³öÉúÄÇÌìΪÐÇÆÚ%d\} }
ʵÑéÁù CÑ»·½á¹¹³ÌÐòÉè¼Æ
1. ±à³Ì£ºÊä³ö200ÒÔÄÚËùÓÐÄܱ»7Õû³ýµÄÊý¡£
2. ±à³Ì£ºÇó³ö1 ~ 1000Ö®¼äÄܱ»13Õû³ýµÄ×î´óµÄÄǸöÊý¡£ 3. ±à³Ì£ºÕÒ³öÈô¸É¸ö·ÇÁãÊýÖеÄ×îСֵmÒÔ¼°ËüÃǵÄƽ¾ùÖµa¡£
ÒªÇó£ºÈô¸É¸öÊýÓɼüÅÌÊäÈ룬ÿ´ÎÊäÈëÒ»¸ö¸³¸ø±äÁ¿x£¬xΪÁãʱ£¬½áÊøÊäÈë¡£ 4. ±à³Ì£ºÇóÁ½¸öÕýÕûÊým¡¢nÖ®¼äËùÓÐÆæÊýÖ®ºÍxÓëżÊýÖ®ºÍy¡£ ÒªÇó£º
£¨1£©m¡¢nµÄÖµÓɼüÅÌÊäÈë¡£
£¨2£©ÊäÈëʱ£¬ÔÊÐíÓû§ËæÒâÏÈÊäÈë´óµÄ»òСµÄÕûÊý¡£
5. ±à³Ì£º¼ÆË㺯ÊýyµÄÖµ¡£ÒªÇó¼üÅ̽ÓÊÕ×Ô±äÁ¿xµÄÖµ£¬ÈôxµÄÖµ²»ÎªÁ㣬¼ÆË㺯ÊýyµÄÖµ²¢Êä³ö£¬ÔÙ´Ó¼üÅ̽ÓÊÕÏÂÒ»¸öxµÄÖµ£¬¡¡£¬Ö±µ½xµÄֵΪÁ㣬ÏÔʾ¡°Thank You£¬Bye!¡±£¬¶ûºó½áÊø³ÌÐò£¬ÒÑÖªº¯ÊýyÓë×Ô±äÁ¿xµÄ¹ØϵΪ£º
6. ±à³Ì£º¼ÆËã¦ÐµÄ½üËÆÖµ£¬¦ÐµÄ¼ÆË㹫ʽΪ£º
ÒªÇó£º
£¨1£©nÖµÓɼüÅÌÊäÈë¡£
£¨2£©·Ö±ðÊä³öµ±n Ϊ10¡¢100¡¢1000ʱµÄ¼ÆËã½á¹û¡£ £¨3£©Êä³öʱҪÇóÿÐÐÏÔʾһ×én¡¢¦ÐµÄÖµ£¬Ã¿ÐÐÐÎʽÈçÏ£º n£½¾ßÌåÖµ£¬¦Ð = ¾ßÌåÖµ
7. ÎÒ¹úÏÖÓÐÈË¿Ú13ÒÚ£¬ÉèÄêÔö³¤ÂÊΪ1%,±àд³ÌÐò£¬¼ÆËã¶àÉÙÄêºóÔö¼Óµ½20ÒÚ¡£
8. Çó½â°®Òò˹̹ÊýѧÌâ¡£ÓÐÒ»Ìõ³¤½×ÌÝ£¬Èôÿ²½¿ç2½×£¬Ôò×îºóÊ£Óà1½×£»Èôÿ²½¿ç3½×£¬Ôò×îºóÊ£2½×£»Èôÿ²½¿ç5½×£¬Ôò×îºóÊ£4½×£»Èôÿ²½¿ç6½×£¬Ôò×îºóÊ£5½×£»Èôÿ²½¿ç7½×£¬×îºó²ÅÕýºÃÒ»½×²»Ê£¡£ÇëÎÊ£¬ÕâÌõ½×ÌÝ×îÉÙ¹²ÓжàÉÙ½×?
9. ÿ¸öÆ»¹û0.8 Ôª£¬µÚÒ»ÌìÂò2 ¸öÆ»¹û£¬µÚ¶þÌ쿪ʼ£¬Ã¿ÌìÂòÇ°Ò»ÌìµÄ2 ±¶£¬Ö±ÖÁ¹ºÂòµÄÆ»¹û¸öÊý´ïµ½²»³¬¹ý100 µÄ×î´óÖµ¡£±à³Ì£ºÇóÿÌìƽ¾ù»¨¶àÉÙÇ®£¿£¨´ËÌâΪѡ×ö£© 1.
#include
for(i=1;i<=200;i++) {if(i%7!=0) continue; printf(\} } 2.
#include printf(\} 3. #include {int i;float x,m,s,a; scanf(\if(x!=0) {m=x;s=x;} for(i=1;;i++) {scanf(\if(x==0) break; s=s+x; if(m>x) m=x; } a=s/i; printf(\×îСֵm=%f,ƽ¾ùÖµa=%f\} 4. #include void main() {int i,m,n,t,x=0,y=0; scanf(\if(m>n){t=m;m=n;n=t;} for(i=m;i<=n;i++) if(i%2) x+=i; else y+=i; printf(\printf(\} 5. #include float x,y; printf(\scanf(\for (;x>=0;) { if(x>0&&x<100) { y=3*x+1; printf(\} else if(x>=100) { y=x*x-1; printf(\} else {printf(\scanf(\} } 6. #include printf(\ÇëÊäÈënµÄÖµ\\n\ scanf(\ sum=2; i=1; t=2; while(i t=t*(2*i)*(2*i)/(2*i-1)/(2*i+1); i=i+1; } printf(\\\n\} 7. #include double t=13,s=0; while(t<=20) { t=t*(1+0.01); s++; } printf(\ÐèÒª¾¹ý%lf Äê\} 8. #include while( !(x%2==1&&x%3==2&&x%5==4&&x%6==5)) { x=x+7; } printf(\} 9. #include { d++; n=n*2; p=p+n; } while(p+n*2<=100); s=p*0.8/d; printf(\ÿÌìƽ¾ù»¨%gԪǮ!\\n\} ʵÑéÆß C¶àÖØÑ»·½á¹¹³ÌÐòÉè¼Æ 1. ±à³Ì£ºÊä³ö100ÒÔÄÚ¸öλÊýΪ6ÇÒÄܱ»3Õû³ýµÄËùÓÐÊý¡£ 2. ±à³Ì£º¼üÅÌÊäÈë6 λѧÉúµÄ5Ãſγɼ¨£¬·Ö±ðͳ¼Æ³öÿ¸öѧÉúµÄƽ¾ù³É¼¨¡£ 3. ±à³Ì£ºÊäÈëÒ»¸öÕýÕûÊý£¬Í³¼Æ¸ÃÊýµÄ¸÷λÊý×ÖÖÐÁãµÄ¸öÊý£¬²¢Çó¸÷λÊý×ÖÖеÄ×î´óÕß¡£ 4. ±à³Ì£º·Ö±ðÓÃdo while¡¢while¡¢forÈýÖÖÑ»·½á¹¹Çó£º 1!+2!+3!+...+n! £¬ÒªÇónµÄÖµÓɼüÅÌÊäÈë¡£ 5. ±à³Ì£º¼ÆËã100ÖÁ1000Ö®¼äÓжàÉÙ¸öÊýÆä¸÷λÊý×ÖÖ®ºÍÊÇ5¡£ 6. ±à³Ì£º´Ó¼üÅÌÊäÈëµÄ10¸öÕûÊýÖУ¬ÕÒ³öµÚÒ»¸öÄܱ»7Õû³ýµÄÊý¡£ÈôÕÒµ½£¬Êä³ö´ËÊýºóÍ˳ö£»ÈôδÕÒµ½£¬Êä³ö¡°not exist¡±¡£ 7. ±à³Ì£ºÊä³ö1ÖÁ100Ö®¼äÂú×ãÈçÏÂÌõ¼þµÄÊý£º¸÷λÊýµÄ³Ë»ý´óÓÚ¸÷λÊýµÄºÍ¡£ 8. ±à³Ì£º½«ÕûÊý316±íʾΪÁ½¸ö¼ÓÊýµÄºÍ£¬Ê¹ÕâÁ½¸ö¼ÓÊý·Ö±ðÄܱ»13ºÍ11Õû³ý¡£ 9. ±à³Ì£º´òÓ¡³öËùÓеÄ\Ë®ÏÉ»¨Êý\¡£ËùνµÄ\Ë®ÏÉ»¨Êý\ÊÇÖ¸Ò»¸ö3λÊý£¬Æä¸÷λÊý×ÖµÄÁ¢·½ºÍµÈÓÚ¸ÃÊý±¾Éí¡£ÀýÈ磬153ÊÇÒ»¸ö\Ë®ÏÉ»¨Êý\£¬ÒòΪÓÐ153=1*1*1+5*5*5+3*3*3¡£ 10. ±à³Ì£ºÒ»ÌõÓÐ10¸ö³µÕ¾µÄÌú·Ïߣ¬¹²ÐèҪ׼±¸¶àÉÙÖÖ³µÆ±£¿ 1. #include for(i=1;i<=100;i++) {if(i==6&&i%3==0) printf(\} } 2. #include {int i,j,a[6][5];float s; for(i=0;i<6;i++) {s=0; for(j=0;j<5;j++) {printf(\ÇëÊäÈëµÚ%d¸öѧÉúµÄµÚ%dÃųɼ¨\scanf(\s=s+a[i][j]; } s=s/5; printf(\µÚ%d¸öѧÉúƽ¾ù³É¼¨Îª%f\\n\} } 3. #include {int x,i,max,t; i=0; max=0; scanf(\do {t=x; if(t==0) ++i; else if(max printf(\} 4. #include {int n,i,a,s=0; printf(\ÇëÊäÈën:\scanf(\a=1; for(i=1;i<=n;i++) {a=a*i; s=s+a; } printf(\} #include {int n,i=1,a=1,s=0; printf(\ÇëÊäÈën:\scanf(\while(i<=n) {a=a*i; s=s+a; i++; } print(\} #include {int n,i=1,a=1,s=0; printf(\ÇëÊäÈën:\scanf(\do {a=a*i; s=s+a; i++; } while(i<=n); printf(\} 5. void main() { int i,s,k,count=0; for(i=100;i<1000;i++) { s=0; k=i; while(k) { s=s+k; k=k/10; } if(s!=5) continue; else count++; } printf(\} 6. #include printf(\ÇëÊäÈë10¸öÕûÊý:\for(i=1;i<=10;i++) {scanf(\if(x%7==0) {printf(\} } if(i>10) printf(\} 7. #include {int n,k=1,s=0,m ; for (n=1;n<=100;n++) {k=1;s=0;m=n; while (m>=1) {k*=m; s+=m; m=m/10 ; } if(k>s) } } 8. #include printf(\} 9. #include {int i,j,k,n; for(n=100;n<1000;n++) { i=n/100; j=(n-i*100)/10; k=n; if(i*i*i+j*j*j+k*k*k==n) printf(\ printf(\ } } ʵÑé°Ë C³ÌÐò¿ØÖƽṹ×ÛºÏÓ¦Óà 1. ±à³Ì¼ÆË㣺 s=1+12+123+1234+12345+123456+1234567¡£ 2. ±à³Ì: ÕÒ³ö1ÖÁ99Ö®¼äµÄÈ«²¿Í¬¹¹Êý¡£Ëùνͬ¹¹ÊýÊÇÕâÑùÒ»×éÊý£ºËü³öÏÖÔÚÆäƽ·½ÊýµÄÓұߡ£ÀýÈ磺5ÊÇ25ÓұߵÄÊý£¬25ÊÇ625ÓұߵÄÊý£¬5ºÍ25¶¼ÊÇͬ¹¹Êý¡£ 3. ÈôÓÃ0ÖÁ9Ö®¼ä²»Í¬µÄÈý¸öÊý¹¹³ÉÒ»¸öÈýλÊý£¬±à³Ìͳ¼Æ¹²ÓжàÉÙÖÖ·½·¨¡£ 4. ±à³Ì£º¼üÅÌÊäÈëÒ»¸ö²»¶àÓÚ5λµÄÕýÕûÊý£¬ÒªÇ󣺣¨´ËÌâΪѡ×ö£© (1) ÇóËüÊǼ¸Î»Êý (2) ÄæÐò´òÓ¡³ö¸÷λÊý×Ö¡£ÈçÔÊýΪ123£¬Êä³öÔòΪ321¡£ 5. ±à³Ì£ºÕÒ³öÒÔÏÂÒÉ°¸µÄ×÷°¸ÈË£¨´ËÌâΪѡ×ö£© ÒÑÖª¸Ã°¸Éæ¼°6¸öÏÓÒÉÈËA¡¢B¡¢C¡¢D¡¢E¡¢F£¬²¢ÇÒ£º (1) A¡¢BÖÁÉÙÓÐÒ»ÈË×÷°¸¡£ (2) A¡¢E¡¢FÕâ3ÈËÖÐÖÁÉÙÓÐ2È˲ÎÓë×÷°¸¡£ (3) A¡¢D²»¿ÉÄÜÊÇͬ°¸·¸¡£ (4) B¡¢C»òͬʱ×÷°¸£¬»òÓë±¾°¸Î޹ء£ (5) C¡¢DÖÐÓÐÇÒ½öÓÐÒ»ÈË×÷°¸¡£ (6) Èç¹ûDûÓÐ×÷°¸£¬ÔòEÒ²²»¿ÉÄܲÎÓë×÷°¸¡£ 6. ±à³Ì£ºÊä³öÏÂÁÐÐÎʽµÄÑî»ÔÈý½ÇÐεÄÇ°10ÐУ¨´ËÌâΪѡ×ö£© 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 ¡¡ 1. #include {int s=0,i=1,t=0; while(i<10) {t=t*10+i;s+=t;i++; } printf(\} 2. #include main() {int i; for(i=1;i<=99;i++) if(i*i==i||i*i0==i) printf(\} 3. #include {int i,j,k,count=0; } for(i=1;i<=9;i++) for(j=0;j<=9;j++) if(i==j) continue; else for(k=0;k<=9;k++) if(k!=i&&k!=j) count++; printf(\ ʵÑé¾Å CµÄÊý×é 1. ±à³ÌʵÏÖ£ºÊäÈëÒ»¸öÕýÕûÊýn£¨1 ÀýÈ磺ÊäÈë5£¬ÔÙÊäÈëÈý¸öÊý8¡¢23¡¢1¡¢7¡¢19£¬ÔòÊä³öΪ£º19¡¢7¡¢1¡¢23¡¢8¡£ 2. ±à³ÌʵÏÖ£ºÊäÈë10¸öÕýÕûÊý£¬½«ËüÃÇÖеÄ×îСֵÓëµÚÒ»¸öÊý½»»»£¬×î´óÖµÓë×îºóÒ»¸öÊý½»»»£¬È»ºóÊä³ö½»»»ºóµÄ10¸öÊý¡£ 3. ±à³ÌʵÏÖ£ºÒÑÖª¶þ´ÎµÈ²îÊýÁеÄÇ°4ÏîΪ2,5,10,17£¬Ç붨ÒåһάÕûÐÍÊý×é´æ´¢¸ÃÊýÁеÄÇ°20Ï²¢Ã¿5¸öÊýΪһÐÐÊä³ö¸ÃÊýÁеÄÇ°20Ïî¡£ 4. ÒÑÖªÒ»×éÕûÐÍÊý¾ÝÒÑ°´´ÓСµ½´óÅÅÁкã¬ÏÖÈÎÒâÊäÈëÒ»¸öÕûÊý£¬Çë°´ÔÀ´ÅÅÐòµÄ¹æÂɽ«Ëü²åÈëµ½Êý×éÖÐ(ÀýÈ磺ÔÀ´µÄÒ»×éÕûÊýΪ1,3,5,8,9,ÈôÊäÈëµÄÕûÊýÊÇ7£¬Ôò×îÖյĽá¹ûΪ: 1,3,5,7,8,9)£¬Çë±à³ÌʵÏÖ¡£ 5. ±à³Ì£º½«Ò»¸ö4¡Á4µÄÕûÐ;ØÕóÔªËØ°´¸±¶Ô½ÇÏߣ¨ÓÒÉϵ½×óÏ£©»¥»»¡£ ÒªÇó£º £¨1£©¼üÅÌÊäÈë¾ØÕó¸÷ÔªËصÄÖµ¡£ £¨2£©»¥»»Ç°£¬°´¾ØÕóÐÎʽÊä³ö¾ØÕó¡£ £¨3£©»¥»»ºó£¬°´¾ØÕóÐÎʽÊä³ö¾ØÕó¡£ 6. ÇóÒ»¸ö4¡Á4µÄÕûÊý¾ØÕóµÄ¸±¶Ô½ÇÏߣ¨ÓÒÉϵ½×óÏ£©ÉÏËùÓÐÆæÊýµÄºÍsum¼°Å¼ÊýµÄƽ¾ùÖµave¡£ ÒªÇ󣺽á¹û±£Áô2λСÊý 7. ͨ¹ýÑ»·°´ÐÐ˳ÐòΪһ¸ö5¡Á5µÄ¶þάÊý×éa¸³1µ½25µÄ×ÔÈ»Êý£¬È»ºóÊä³ö¸ÃÊý×éµÄ×óÏ°ë½ÇÔªËصÄÖµºÍËüÃÇÖ®ºÍ¡£ 8. ¶¨ÒåÒ»¸öʵÊýÐÍÊý×飬½«10¸öʵÊýÊäÈëµ½Êý×éÖУ¬±à³ÌʵÏÖÈÎÒ»¿éÇø¼äËùÓÐÔªËصÄƽ¾ùÖµ£¬¼´ÊäÈëÁ½ÕûÊým£¬n£¬¼ÆËã³öÊý×éÖеÚm¸öÔªËØ¿ªÊ¼µÄºón¸öÔªËصÄƽ¾ùÖµ£¬°üÀ¨µÚm¸öÔªËØ(ÈônÖµ¹ý´ó£¬¼´¸öÊýÌ«¶à£¬³¬¹ýÊý×éµÄ×îºóÒ»¸öÔªËØ£¬Ôòͳ¼Æµ½×îºóÒ»¸öÔªËØ)¡£ ÀýÈ磺Êý×éÔªËØΪ1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0£¬ÊäÈë3,5£¬ÔòÊä³ö5.0¡£ 9. Ò»¸öÕûÐÍÊý×éÓÐ10¸öÔªËØ£¬±àд³ÌÐòɾ³ýËùÓÐֵΪnµÄÔªËØ¡£È磺Êý×éÖÐΪ1,3,2,4,2,7,9£¬0,2,5£¬nµÄֵΪ2£¬É¾³ýºóÊä³öÊý×éÔªËØÓ¦¸ÃΪ1,3,4,7,9,0,5¡££¨´ËÌâΪѡ×ö£© 10. ¶¨ÒåÁ½¸öNÐÐNÁеĶþάÊý×éa¡¢b£¬±àд³ÌÐò£¬½«aÊý×é×îºóÒ»Ðзŵ½bÊý×éµÄµÚ0ÁÐÖУ¬°ÑaÊý×éÖеĵÚ0Ðзŵ½bÊý×éµÄ×îºóÒ»ÁÐÖУ¬bËùÖ¸¶þάÊý×éÖÐÆäËûÔªËصÄÊý¾Ý²»±ä¡££¨´ËÌâΪѡ×ö£© 11. ÊÔ±à³ÌʵÏÖÈçϹ¦ÄÜ£ºÏȶ¨ÒåÒ»¸ö4ÐÐ5ÁеÄÊý×飨¾ØÕ󣩣¬µ÷Óÿ⺯Êýrand()Ëæ»ú²úÉú20-50Ö®¼äµÄÕûÊý¸øÊý×éÔªËظ³Öµ£¬ÔÙ½«¾ØÕóÖеڶþÁÐÓëµÚËÄÁеÄÔªËØ»¥»»¡£ÒªÇóÏÈÊä³öÔÊý×飬ÔÙÊä³ö½»»»ºóµÄÊý×飨randº¯ÊýµÄʹÓÃÇë²ÎÔĽ̲Ä259Ò³£©¡££¨´ËÌâΪѡ×ö£© 1. #include int a[10],n,i; scanf(\ for(i=n-1;i>=0;i--)scanf(\for(i=0;i #include int n,i,a[10],max,min,t,r,p; scanf(\for (i=1;i<=n;i++) scanf(\min=a[1]; for (i=1;i<=n;i++) { if (a[i] } } t=a[1],a[1]=min,a[r]=t; max=a[n]; for (i=1;i<=n;i++) { if (a[i]>a[n]) { max=a[i]; p=i; } } t=a[n],a[n]=max,a[p]=t; for (i=1;i<=n;i++) printf(\} 3. #include printf(\ if(i%5==0) } } 4. #include {int a[10]={1,3,5,7,9,11,13,15,17},i,j,n; printf(\ÇëÊäÈë1¸öÕûÊý\scanf(\for(i=0;i<9;i++) if(a[i]>n) {for(j=9;j>i;j--)a[j]=a[j-1]; a[i]=n; break; } if(n>=a[8])a[9]=n; for(i=0;i<10;i++) printf(\printf(\} printf(\ 6. #include {int a[4][4],i,j,t=0; float s1=0 ,s2=0,ave; for(i=0;i<=3;i++) { for(j=0;j<=3;j++) {printf(\scanf(\} } for(i=0;i<=3;i++) { for(j=3;j>=0;j--) { if(i+j==3) {if(a[i][j]%2!=0) {s1=s1+a[i][j]; } else { t++; s2=s2+a[i][j]; ave=s2/t; } } } } printf(\} 7. #include int i,j,k=1,s=0; int a[5][5]; for(i=0;i<5;i++) { for(j=0;j<5;j++) { a[i][j]=k; k++; } } putchar(10); for(i=0;i<5;i++) { for(j=0;j<5;j++) printf(\ printf(\ } putchar(10); for(i=0;i<5;i++) { for(j=0;j<=i;j++) printf(\ printf(\ s=s+a[i][j]; } printf(\} ʵÑéÊ® C×Ö·ûÊý×éºÍ×Ö·û´®º¯Êý* 1. ±àд×Ö·û´®¿½±´³ÌÐò£¬²¢ÒªÇó¿½±´¹ý³ÌÖн«×Ö·û´®ÖеÄСд×Öĸת»»³É´óд×Öĸ¡£ 2. ´Ó¼üÅÌÊäÈëÁ½¸ö×Ö·û´®aºÍb£¬ÒªÇó²»Ê¹Óÿ⺯Êýstrcat£¬°Ñ´®bµÄÇ°5¸ö×Ö·ûÁ¬½Óµ½´®aÖУ»Èç¹ûbÖеij¤¶ÈСÓÚ5£¬Ôò°ÑbµÄËùÓÐÔªËض¼Á¬½Óµ½aÖС£ 3. ÊäÈëÒ»¸öÒԻسµ½áÊøµÄ×Ö·û´®£¨ÉÙÓÚ80¸ö×Ö·û£©£¬ÔÙÊäÈëÒ»¸ö×Ö·û£¬Í³¼Æ²¢Êä³ö¸Ã×Ö·ûÔÚ×Ö·û´®ÖгöÏֵĴÎÊý£¬È»ºóÊä³ö¸Ã×Ö·û´®¡£ 4. ±à³Ì: ÊäÈëÒ»¸ö×Ö·û´®£¬Êä³ö¸Ã×Ö·û´®ÖгöÏÖ´ÎÊý×î¶àµÄ×Ö·ûÒÔ¼°³öÏֵĴÎÊý¡£ 5. ±à³Ì: ¼üÅ̽ÓÊÕÒ»¸ö×Ö·û´®(Ö»º¬´ó¡¢Ð¡Ð´Ó¢ÎÄ×Öĸ)£¬½«¸Ã×Ö·û´®¼ÓÃܺóÊä³ö¡£ ¼ÓÃܹæÔòΪ£ºÈôΪСд×ÖĸÔò²»±ä£¬ÈôΪ´óд×ÖĸÔò½«Æäת»»ÎªÐ¡Ð´ºóÔÙºóÒÆÒ»¸ö×Öĸ£¬ÀýÈç¡°A¡±Ó¦×ª»»Îª¡°b¡±£¬¡°B¡±Ó¦×ª»»Îª¡°c¡±£¬¡°Y¡±Ó¦×ª»»Îª¡°z¡±£¬¶ø¡°Z¡±Ó¦×ª»»Îª¡°a¡±¡£ 6. ±à³Ì£ºÊäÈëÒ»¸öÒԻسµ½áÊøµÄ×Ö·û´®a£¨ÉÙÓÚ80¸ö×Ö·û£©£¬ÔÙÊäÈëÒ»¸ö×Ö·û´®b£¬Í³¼Æ²¢Êä³öbÔÚaÖгöÏֵĴÎÊý£¬È»ºóÔÙÊä³öÕâÁ½¸ö×Ö·û´®¡£ 7. ±à³Ì£ºÊäÈëÒ»¸öÒԻسµ½áÊøµÄ×Ö·û´®£¨ÉÙÓÚ80¸ö×Ö·û£©£¬½«¸Ã×Ö·û´®µ¹Ðò´æ·Åºó°´Ë³ÐòÊä³ö¡£ ÀýÈ磺ÈçÊý×éÖпªÊ¼Ê±ÔªËØΪ¡°abcd¡±£¬³ÌÐòÖ´ÐкóÊý×éÖÐΪ¡°dcba¡±£¬²¢Êä³ö¡°dcba¡± 8. ±à³Ì: ʵÏÖ¶Ô×Ö·û´®µÄ¼ÓÃÜ£¬ÒªÇó´Ó¼üÅÌÊäÈëÒ»¸ö×Ö·û´®£¬Êä³ö¼ÓÃÜÖ®ºóµÄ×Ö·û´®¡££¨´ËÌâΪѡ×ö£© ¼ÓÃܹæÔòΪ£º ¶ÔÓÚ´®ÖеÚÆæÊý¸ö×Ö·û£¬ÈôÊÇ×Öĸ£¬Ôò°Ñ¸Ã×Öĸ±äΪËüºóÃæµÄ×Öĸ£¨ÈôΪZÔò±äΪA£©£¬²»ÊÇ×ÖĸÔò²»±ä£» ¶ÔÓÚ´®ÖеÚżÊý¸ö×Ö·û£¬ÈôÊÇ×Öĸ£¬Ôò°Ñ¸Ã×Öĸ±äΪËüÇ°ÃæµÄ×Öĸ£¨ÈôΪAÔò±äΪZ£©£¬²»ÊÇ×ÖĸÔò²»±ä£» ´óСд×Öĸ¶¼×ñѴ˹æÔò¡£ ÀýÈ磺 ÈôÔ×Ö·û´®ÊÇ£ºAbbaZG Ha-MnnK Yzx ¼ÓÃÜ×Ö·û´®Îª£ºBaczAF Gb-Nmoj Xaw 9. ±à³Ì£ºÊäÈëÒ»ÐÐÓ¢ÎÄ×Ö·û´®£¬Í³¼Æµ¥´ÊµÄ¸öÊý£¨µ¥´ÊºÍµ¥´ÊÒÔ¿Õ¸ñ·Ö¸ô£©¡£×ö£© 1. #include char str1[40],str2[20]; int i,k; printf(\ÇëÊäÈëµÚÒ»¸ö×Ö·û´®\\n\scanf(\ printf(\ÇëÊäÈëµÚ¶þ¸ö×Ö·û´®\\n\scanf(\ for(i=0;str1[i]!='\\0';i++); for(k=0;str2[k]!='\\0';k++) { str1[i]=str2[k]; i++; } str1[i]='\\0'; for(i=0;str1[i]!='\\0';i++) { if(str1[i]>='a' && str1[i]<='z') { str1[i]=str1[i]-32; } } printf(\} 2. #include \main() {char a[80],b[40],*q=a,*p=b;int i=0; printf(\×Ö·û´®a:\gets(a); £¨´ËÌâΪѡ printf(\×Ö·û´®b:\gets(b); while(*q++); q--; while(*p++) i++; p=b; if(i<5) while(i--) *q++=*p++; else for(i=0;i<5;i++) *q++=b[i]; *q='\\0'; puts(a); } 3. #include {char c[80],ch; int i,num=0; printf(\ÇëÊäÈë×Ö·û´®¼°×Ö·û£º\gets(c); ch=getchar(); for(i=0;c[i]!='\\0';i++) if(c[i]==ch) num++; printf(\puts(c); } 4. #include { char str[100],str_sort[100],c; int i,j,len,m; printf(\ÇëÊäÈë×Ö·û´®:\ gets(str); strcpy(str_sort,str); len=strlen(str_sort); for(i=0;i str_sort[j]=str_sort[j+1]; str_sort[j+1]=c; } for(i=1,j=1,m=0;i { if(j>m) { m=j; c=str_sort[i-1]; } j=1; } else j++; printf(\³öÏÖ×î¶àµÄÊÇ:%c %d\\n\ getch(); } 5. #include #include {char c[80],ch; int i,l; gets(c); l=strlen(c); for(i=0;i char i; int c=0; int a=0,sum; scanf(\while(i!='\\n') { } printf(\} if(i=='Z')i=i+32-25,printf(\scanf(\ { if('a'<=i&&i<='z')printf(\if('A'<=i&&i<='Y')i=i+33,printf(\ ʵÑéʮһ CÅÅÐòËã·¨* 1. ±à³ÌʵÏÖ£ºÊäÈën£¨n<10£©¸öÕûÊý£¬°´´Ó´óµ½Ð¡µÄ˳Ðò¶ÔÆäÅÅÐò²¢Êä³ö¡£ 2. ±à³ÌʵÏÖ£ºÊäÈëÒ»¸ö×Ö·û´®£¬°´×Ö·û´ÓСµ½´óµÄ˳Ðò¶ÔÆäÅÅÐòÊä³ö¡£ 3. ±à³ÌʵÏÖ£º¼üÅÌÊäÈëͬÇÞÊÒnλͬѧµÄÐÕÃû£¨ÓúºÓïÆ´Òô±íʾ£©£¬½«ÕânλͬѧµÄÐÕÃû°´×Öĸ˳ÐòÅÅÐòºóÊä³ö¡££¨´ËÌâΪѡ×ö£© 1. #include printf(\ÇëÊäÈëÕâ%d¸öÊý:\ for( i=0;i for(i=0;i for(i=0;i #include char str1[500]={0},str2[256]={0}; printf(\ printf(\ for( j=0;j if(a[j]1&&n<=10)c=0; else printf(\ } int i;gets(str1); for(i=0;str1[i];i++) { str2[str1[i]]=1; } for(i=0;i!=256;i++) if(str2[i]==1) printf(\putchar('\\n'); return 0; } ʵÑéÊ®¶þ Cº¯ÊýµÄ»ù±¾²Ù×÷ 1. ±àдº¯Êý£º¼ÆËãÈý½ÇÐεÄÃæ»ý¡£ÒÑÖªÈý½ÇÐÎÈýÌõ±ß³¤£¬¹«Ê½Îª£º ÆäÖÐx¡¢y¡¢zΪ±ß³¤£¬c=(x+y+z)/2¡£ 2. ±àдº¯Êý£ºÓÃÀ´ÅжÏÒ»¸öÕûÊýÊÇ·ñÂú×ã¡°ÓÃ4³ýÓà1£¬ÓÃ5³ýÓà3£¬ÓÃ7³ýÓà4¡±£¬Âú×ãÔò·µ»Ø1,²»Âú×ã·µ»Ø0£¬È»ºó±àдmainº¯Êý£¬Í¨¹ýµ÷Óøú¯ÊýÏÔʾ³ö200~500Ö®¼äÂú×ã¸ÃÌõ¼þµÄÊý¡£ 3. ±àдº¯Êýisprime( )£¬ÓÃÀ´ÅжÏÒ»¸öÕûÊýaÊÇ·ñΪËØÊý¡£ÔÙ±àдmainº¯Êý£¬Í¨¹ýµ÷Óøú¯Êý´òÓ¡³ö100~300Ö®¼äËùÓеÄËØÊý£¬ÒªÇóÒ»ÐдòÓ¡10¸ö¡£ 4. ±àдº¯Êý£ºÅжÏÒ»¸öÕûÊýÊÇ·ñΪˮÏÉ»¨Êý£¬²¢±àдÖ÷³ÌÐòµ÷Óøú¯ÊýÇó³öËùÓеÄË®ÏÉ»¨Êý¡£ 5. Óõü´ú·¨Çó¡£µü´ú¹«Ê½Îª£º µü´úµ½ÎªÖ¹ £¬Îª·½³ÌµÄ½üËƽ⡣ 6. ËùνÍêÊý¾ÍÊÇËüËùÓÐÒò×ӵĺ͵ÈÓÚÆä×ÔÉí×ÔÈ»Êý£¬Èç6=1+2+3£¬6¾ÍÊÇÒ»¸öÍêÊý¡£±àдÁ½¸öº¯Êý£ºº¯Êýfactor(n)ÓÃÀ´ÅжÏnÊÇ·ñÊÇÍêÊý£¬º¯ÊýPriFac(n)ÓÃÀ´ÏÔʾÍêÊýnµÄËùÓÐÒò×Ó£¬ÔÚÖ÷º¯ÊýÖе÷ÓÃÕâÁ½¸öº¯Êý£¬ÏÔʾ1¡«30000¼äµÄËùÓÐÍêÊý¡£ 7. ÒÔϺ¯ÊýpµÄ¹¦ÄÜÊÇÓõݹ鷽·¨¼ÆËãxµÄn½×ÀÕÈõ¶àÏîʽµÄÖµ¡£ÒÑÓе÷ÓÃÓï¾äp£¨n£¬x£©£»Çë±àдpº¯Êý¡£µÝ¹é¹«Ê½ÈçÏ£º£¨´ËÌâΪѡ×ö£© float p(int n, int x) { } 1. #include { double a, b, c, p, s; printf(\ÇëÊäÈëa, bºÍc£º\ scanf(\ p = (a + b + c) / 2; s = sqrt(p * (p - a) * (p - b) * (p -c)); printf(\´ËÈý½ÇÐεÄÃæ»ýΪ£º%lf\\n\ return 0; } 2. #include while(m<=n) { if(m%4==1&&m%5==3&&m%7==4) {printf(\m++; } } void main() { fun(200,500); } 3. #include for(y=x-1;y>=1;y--) { if(x%y==0) {return y; break;} } } main() {int i,j=0,m; for(i=100;i<=300;i++) {m=isprime(i); if(m==1) {printf(\j++; if(j==0) printf(\} } } 4. #include for(x=100;x<1000;x++) { a=(x/100); b=(x/10); c=x; if( x==a*a*a+b*b*b+c*c*c) printf(\ } } main() {int y; fun(y); } 5. #include { double a, b, c, d, e; printf(\ scanf(\ e = pow(a, 1.0/3); do { c = b * 2/3 + a / (3 * b * b); d = c - b; b = c; } while((d <= -0.00001) || (d >= 0.00001)); printf(\6. #include void prifac(int n); int w[10],k; main() { int m,n; for(n=2;n<=3000;n++) } int factor(int n) {int s,i; k=-1; s=n; for(i=1;i void prifac(int n) {int i; printf(\ÊÇÍêÊý\\n\} {m=factor(n); if(m==1)prifac(n); } ʵÑéÊ®Èý Cº¯Êýµ÷ÓÃÖеÄÊý¾Ý´«µÝ 1. ±à³ÌʵÏÖ£ºÔÚÖ÷³ÌÐòmain( )ÖÐÊäÈë2¸öÕûÊý£¬Í¨¹ýµ÷Óú¯Êý½«Á½ÕßµÄÖµ»¥»»(ÒªÇó·Ö±ðÓõØÖ·´«µÝ·½Ê½¡¢È«¾ÖÍⲿ±äÁ¿´«µÝ·½Ê½±à³Ì)¡£ 2. ±àдº¯Êý£º¹¦ÄÜÊÇɾ³ý×Ö·û´®sÖеÄËùÓÐÊý×Ö×Ö·û¡£ 3. ±àдº¯Êý£º¹¦ÄÜÊÇ·µ»Ø×Ö·û´®sÖеÄÖ¸¶¨×Ö·ûcµÄ³öÏÖ´ÎÊý¡£ 4. ÔÚmainº¯ÊýÖУ¬¶¨ÒåÒ»¸öº¬N¸öÔªËصÄÊý×飬ÆäÖÐNÊÇ·ûºÅ³£Á¿£¬È»ºó±àдÏÂÁи÷×Óº¯ÊýÍê³ÉÏàÓ¦µÄ¹¦ÄÜ£º £¨1£©±àдº¯Êýsr£ºÎª¸ÃÊý×é¸÷ÔªËظ³Öµ£¨ÒªÇóµ÷ÓÃËæ»úº¯ÊýΪ¸÷Êý×éÔªËظ³Öµ£©¡£ £¨2£©±àдº¯Êýsc£º´òÓ¡¸ÃÊý×é¸÷ÔªËØ£¬ÒªÇóÿÐдòÓ¡m¸öÊý£¬ÆäÖÐm×÷ΪÐβδ«µÝ¡£ £¨3£©±àдº¯Êýjs£ºÇó¸ÃÊý×éÔªËصÄ×î´óÖµºÍ×îСֵ£¬×î´óÖµºÍ×îСֵͨ¹ý²ÎÊý´«µÝ·µ»ØÖ÷µ÷º¯Êý¡£ £¨4£©±àдº¯Êýpx£ºÊµÏÖ¶ÔÊý×éµÄÅÅÐò¡£ ¸÷¸öº¯Êý±àдÍê³Éºó£¬Çë±àдmainº¯Êý£¬²¢ÔÚmainÖзֱðµ÷ÓÃÒÔÉÏËĸöº¯Êý£¬ÒÔÑéÖ¤¸÷×Óº¯ÊýµÄ¹¦ÄÜ¡£ 1. #include printf(\scanf(\swap(&a,&b); printf(\½»»»ºó:a=%d,b=%d\\n\} void swap(int *p1,int *p2) { int t; t=*p1,*p1=*p2,*p2=t; } 2. #include printf(\scanf( \Swap(x,y); printf(\} void Swap() { int temp; temp=x; x=y; y=temp; return; } 3. #include void fun(char c[80], char x[1]) {int i = 0; int bit = 0; for(i = 0; c[i]; i++) { if(c[i] !=x[0] ) { c[bit] = c[i]; bit++; } } c[bit]='\\0'; } void main() {char c[80];char a[1]; printf(\ÇëÊäÈëÒ»´®×Ö·û£º\scanf(\ printf(\ÇëÊäÈëҪɾ³ýµÄÊý£º\scanf(\fun(c,a); printf(\} ʵÑéÊ®Îå CµÄÖ¸Õë 1. ÓÃÖ¸Õë·½·¨£¬±àдһ¸öº¯Êý,Çó¾ØÕóÖ÷¶Ô½ÇÏßËùÓÐżÊýÔªËØÖ®ºÍSum¡£ 2. ±à³Ì£ºÓÃ×Ö·ûÖ¸ÕëʵÏÖº¯Êýstrcat(s,t)£¬½«×Ö·û´®t¸´ÖƵ½×Ö·û´®sµÄδ¶Ë£¬²¢ÇÒ·µ»Ø×Ö·û´®sµÄÊ×µØÖ·¡£ 3. ÓÃÖ¸Õë±à³Ì£ºÊäÈëÒ»¸ö×Ö·û´®£¬¼ÆËã¸Ã×Ö·û´®µÄ³¤¶È£¬²¢Í³¼Æ¸Ã´®ÖÐËùº¬Ð¡Ð´×Öĸ¡¢´óд×ÖĸºÍÆäËû×Ö·ûµÄ¸öÊý¡£ 4. ÓÃÖ¸Õë±à³Ì£º ½«×Ö·û´®a¸³¸øÒ»¸ö×Ö·ûÊý×飬Ȼºó´ÓµÚÒ»¸ö×Öĸ¿ªÊ¼¼ä¸ôµØÊä³ö¸Ã´®¡£ÀýÈ磬ÊäÈëµÄÊÇabcdefghijkl£¬ÔòÊä³öΪacegik¡£ 5. ÓÃÖ¸Õë±à³Ì£ºÓÐÒ»¸öÊýÁУ¬º¬ÓÐ20¸öÕûÊý£¬±àдº¯Êý£¬ÒªÇóÄܹ»¶Ô´ÓÖ¸¶¨Î»ÖÿªÊ¼µÄn¸öÊý°´Ï෴˳ÐòÖØÐÂÅÅÁУ¬²¢ÔÚmainÖÐÊä³öеÄÊýÁС£ ÀýÈ磬ÔÊýÁÐΪ£º 1£¬2£¬3£¬4£¬5£¬6£¬7£¬8£¬9£¬10 ÈôÒªÇó¶Ô´Ó3¸öÊý¿ªÊ¼µÄ5¸öÊý½øÐÐÄæÐò´¦Àí£¬Ôò´¦ÀíºóµÄÐÂÊýÁÐΪ£º 1£¬2£¬7£¬6£¬5£¬4£¬3£¬8£¬9£¬10 6. ÓÃÖ¸Õë±à³Ì£ºÊäÈëÒ»¸ö4¡Á5µÄ¶þάÕûÐÍÊý×飬Êä³öÆäÖÐ×î´óÖµ¡¢×îСֵÒÔ¼°ËüÃÇËùÔÚÐкÍÁеÄϱꡣ 7. ÓÃÖ¸Õë±à³Ì£º´Ó¼üÅÌÊäÈë15¸öÕûÊý´æÈëһάÊý×飬°´ÄæÐò´æ·ÅºóÔÙÊä³ö¡£ 1. #include main() {int a[4][4]={1,2,3,4,2,3,4,5,3,4,6,6,4,5,6,8},*p[4],i,j,sum=0; for(i=0;i<4;i++) p[i]=&a[i]; for(i=0;i<4;i++) {if (*(p[i]+i)%2==0) sum+=*(p[i]+i); } printf(\} 2. #include #include {char a[100],*p=a; int x=0,y=0,z=0,n=0; gets(a); while(*p!='\\0') { } 4. #include if(*p>='a'&&*p<='z') x++; y++; z++; else if(*p>='A'&&*p<='Z') else p++; n++;} printf(\Сд=%d,´óд=%d,ÆäËû=%d,³¤¶È=%d\\n\ #include {char a[100],b[100],*p=a,*q=b; int i=0; gets(a); i=strlen(a); while(p #include void invert(int *A, int pos, int n) { int i; int *p,t; p=A+pos; for(i=0;i *(p+i)=*(p+n-1-i); } void main() { int i,x,y; int a[20]; printf(\ÇëÊäÈë20¸öÊý£º\\n\for(i=0;i<20;i++) { } printf(\´ÓµÚx¸öÊý¿ªÊ¼£¬¶ÔºóÃæµÄy¸öÊý½øÐдÓСµ½´óÅÅÐò,ÊäÈëx¡¢y:\\n\scanf(\printf(\ÔʼÊýÁÐÊÇ£º\\n\for(i=0;i<20;i++) { } invert(a,x,y); printf(\ÅÅÐòºóµÄÊýÁÐΪ£º\\n\for(i=0;i<20;i++) { } } printf(\printf(\ scanf(\ *(p+n-1-i)=t; } 6. #include {int i,j,a[4][5],*p=*a,min,max,e,b,c,d; for(i=0;i<4;i++) } } } 7. #include {int a[15],*p[15],t,i; for(i=0;i<15;i++) scanf(\ for (i=0;i<15;i++) p[i]=&a[i]; for (i=0;i<15/2;i++) {t=*p[i];*p[i]=*p[14-i];*p[14-i]=t;} for(i=0;i<15;i++) printf(\} printf(\×î´óֵΪ£º%d£¬Ðб꣺%d,Áб꣺%d\\n\ printf(\×îСֵΪ£º%d£¬Ðб꣺%d,Áб꣺%d\\n\ p++; if(min>*p) { min=*p; b=j; for(j=0;j<5;j++) {scanf(\ if(i==0&&j==0) {max=*p; min=*p; e=0; b=0; c=0; d=0; if(max<*p) { max=*p; c=i; d=j; } e=i; }