CÓïÑÔ»ù´¡Á·Ï°Ì⺬´ð°¸ ÏÂÔØ±¾ÎÄ

ÄÚÈÝ·¢²¼¸üÐÂʱ¼ä : 2026/2/4 20:53:19ÐÇÆÚÒ» ÏÂÃæÊÇÎÄÕµÄÈ«²¿ÄÚÈÝÇëÈÏÕæÔĶÁ¡£

#include ¡±stdio.h¡± #include ¡±math.h¡± main() {

float a,b,c,t,disc,w,term1,term2; printf(¡±enter a,b,c:¡±); scanf(%f%f%f¡±,&a,&b,&c); if (¡¾1¡¿)

if (¡¾2¡¿) printf(¡±no answer due to input error\\n¡±); else printf(¡±the single root is %f\\n¡±, - c/b); else

{ disc=b*b-4*a*c; w=2*a; term1= -b/w; t=abs(disc); term2=sqrt(t)/w; if (¡¾3¡¿)

printf(¡±complex root\\n real part=%f imag part =%f\\n¡±, term1,term2); else

printf(¡±real roots\\n root1=%f root2=%f\\n¡±, term1+term2,term1-term2);

} }

12£®ÒÔϳÌÐò¸ù¾ÝÊäÈëµÄÈý½ÇÐεÄÈý±ßÅжÏÊÇ·ñÄÜ×é³ÉÈý½ÇÐΣ¬Èô¿ÉÒÔÔòÊä³öËüµÄÃæ»ýºÍÈý½ÇÐεÄÀàÐÍ¡£ÇëÔÚ¡¾¡¿ÄÚÌîÈëÕýÈ·ÄÚÈÝ¡£ #include ¡±math.h¡± #include ¡±stdio.h¡± main() {

float a,b,c,s,area;

printf(¡±please input three edges of a triangle:¡±); scanf(¡±%f%f%f¡±,&a,&b,&c); if (¡¾1¡¿) { s=(a+b+c)/2;

area=sqrt(s*(s-A*(s-B*(s-c));

printf(¡±\\nthe area of the triangle is: %f¡±,area); if ((a==b)&&(b==c)) printf(¡±µÈ±ßÈý½ÇÐΡ±); else if (¡¾2¡¿) printf(¡±µÈÑüÈý½ÇÐΡ±): else if (¡¾3¡¿) printf(¡±Ö±½ÇÈý½ÇÐΡ±): else printf(¡±Ò»°ãÈý½ÇÐΡ±):

}

else printf(¡±²»ÄÜ×é³ÉÈý½ÇÐΡ±)£» }

13£®ÒÔϳÌÐòµÄ¹¦ÄÜÊÇÅжÏÊäÈëµÄÄê·ÝÊÇ·ñÊÇÈòÄê¡£ÇëÔÚ¡¾¡¿ÄÚÌîÈëÕýÈ·ÄÚÈÝ¡£ #include ¡±stdio.h¡± main() {

int year, flag;

printf(¡±please input the year to jude whether it is a leap year:¡±); scanf(¡±%d¡±,&year); if (year@0==0) flag=1; else if (¡¾1¡¿) flag=1; else ¡¾2¡¿;

if (flag) printf(¡±%d is a leap year\\n¡±,year); else printf(¡±%d is not a leap year!\\n¡±,year); }

14£®ÒÔϳÌÐòÊǶÔÓû§ÊäÈëµÄ×Öĸ½øÐдóСдת»»¡£ÇëÔÚ¡¾¡¿ÄÚÌîÈëÕýÈ·ÄÚÈÝ¡£ #include ¡±stdio.h¡± main() {

char ch;

printf(¡±please input a letter:¡±); scanf(¡±%c¡±,&ch); if (¡¾1¡¿) ch=ch+32; else if (ch>=¡¯a¡¯ && ch<=¡¯z¡¯) ¡¾2¡¿;

printf(¡± the converted letter is: %c\\n¡±,ch); }

15£®ÒÔϳÌÐòÊǶԴӼüÅÌÊäÈëµÄÈκÎÈý¸öÕûÊý£¬Çó³öÆäÖеÄ×îСֵ¡£ÇëÔÚ¡¾¡¿ÄÚÌîÈëÕýÈ·ÄÚÈÝ¡£ #include ¡±stdio.h¡± main() {

int a,b,c,min;

printf(¡±please input three numbers:¡±); scanf(¡±%d%d%d¡±,&a,&b,&c); if (¡¾1¡¿) min=b; else min=a; if (min>c) ¡¾2¡¿;