正文描述:《初学c语言编程》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#includevoidmain(){inta=10,b=11,c1,c2;printf("c1=%d,c2=%d",c1,c2);c1=++a;c2=b++;printf("c1=%d,c2=%d",c1,c2);a=10;b=1;c1=a--;printf("c1=%d,c2=%d",c1,c2);}#includevoidmain(){floatPI=3.14,r=3,h=6,l,s,v;l=2*PI*r;s=PI*r*r;v=s*h;printf("%1.2f,%1.2f,%1.
2、2f",l,s,v);}#includevoidmain(){chara,b;scanf("%c%c",&a,&b);printf("%c%c",a,b);}#includevoidmain(){chara,b;a=getchar();putchar('a','b');}#includevoidmain(){charc1,c2,c3,c4,c5;c1='C',c2='h';c3='i',c4='n';c5='a';printf("%c%c%c%c%c",c1,c2,c3,c
3、4,c5);c1=c1+4;c2=c2+4;c3=c3+4;c4=c4+4;c5=c5+4;printf("%c%c%c%c%c",c1,c2,c3,c4,c5);}#includevoidmain(){floatc,f;scanf("%f",&f);c=(5.0/9)*(f-32);printf("%2.1f",c);}#includevoidmain(){floata,b,c,s,area;printf("inputa,b,c:");scanf("%f,%f,%f",&a,&b,&c);if(a
4、!=0&&b!=0&&c!=0&&a+b>c&&a+c>b&&b+c>a){s=(a+b+c)/2;area=sqrt(s*(s-a)*(s-b)*(s-c));printf("area=%f",area);}else{printf("Itisnotatriangle.");}}#includevoidmain(){floata,b,c,x1,x2,p,q;printf("inputa,b,c:");scanf("%f,%f,%f",&a,&b,&c);if(b*b-4*a*c>0){p=(-b)/2*a;q=
5、sqrt(b*b-4*a*c)/2*a;x1=p+q;x2=p-q;printf("%f,%f",x1,x2);}else{printf("b*b-4*a*c<=0");}}#includevoidmain(){intx=3,y=2,l;floata=2.5,b=3.5;l=(x+y)%2+(int)a/(int)b;printf("%d",l);}#includevoidmain(){chara,ch;a=97;ch='a'+'8'-'3';printf("ch=%d",ch);}#incl
6、udevoidmain(){floatscore;printf("inputscore:");scanf("%f",&score);if(score>=60){if(score>=80)printf("ÓÅÐã");elseprintf("¼°¸ñ");}else{printf("²»¼°¸ñ");}}#includevoidmain(){floatscore;printf("inputscore:");scanf("%f",&score);if(score>=80)printf("ÓÅÐã");els
7、eif(score>=60)printf("¼°¸ñ");else{printf("²»¼°¸ñ");}}#includevoidmain(){intnum;printf("inputnum:");scanf("%d",&num);if(num<=100){if(num<=50)printf("num<=50");elseprintf("50150");}}#include
8、io.h>voidmain(){inta,b;scanf("%d%d",&a,&b);switch(a%2){case0:switch(b%2){case0:printf("a,bareeven");break;case
显示全部收起