实验1嘿嘿嘿
作者:互联网
一、列小人 #include<stdio.h> int main(){ printf("0000000000\n"); printf("0 0 0 0\n"); printf("0 0 0 \n"); printf("0 00000 0\n"); printf("0000000000 \n"); printf(" < >\n"); printf(" < > \n"); printf(" < HHH >>>>>>>>> \n"); printf(" <HHHHHH> \n "); printf(" <HHH> \n"); printf(" I I \n "); printf(" I I \n"); printf(" III III\n"); printf("0000000000\n"); printf("0 0 0 0\n"); printf("0 0 0 \n"); printf("0 00000 0\n"); printf("0000000000 \n"); printf(" < >\n"); printf(" < > \n"); printf(" < HHH >>>>>>>>> \n"); printf(" <HHHHHH> \n "); printf(" <HHH> \n"); printf(" I I \n "); printf(" I I \n"); printf(" III III\n"); return 0; } ---------------------------------------------------------------------- 二、算术1、 #include<stdio.h> int main(){ int x,y; int r1,r2,r3,r4; x=1; y=2; r1=x+y; r2=x-y; r3=x*y; r4=x/y; printf("r1=%d\n",r1); printf("r2=%d\n",r2); printf("r3=%d\n",r3); printf("r4=%d\n",r4); return 0; } ------------------------------------------------------------------------------ 三、算术2 #include<stdio.h> int main(){ float x,y; float r1,r2,r3,r4; x=1; y=2; r1=x+y; r2=x-y; r3=x*y; r4=x/y; printf("r1=%f\n",r1); printf("r2=%f\n",r2); printf("r3=%f\n",r3); printf("r4=%f\n",r4); return 0; } --------------------------------------------------------------------------------- 四、算术3 #include<stdio.h> int main(){ int n,r1,r2,r3,r4; n=100; r1=n*(n+1)/2; r2=(n+1)*n/2; r3=n/2*(n+1); r4=(n+1)/2*n ; printf("n=%d\n",n); printf("r1=%d\n",r1); printf("r2=%d\n",r2); printf("r3=%d\n",r3); printf("r4=%d\n",r4); return 0; } ---------------------------------------------------------------------------------- 五、Question #include<stdio.h> int main(){ int answer1,answer2; char words1[5000],words2[5000]; printf("什么动物可以贴在墙上?\n"); printf("1.大象\n"); printf("2.老鼠\n"); printf("3.海豹\n"); printf("你的选择_____(小孩子才做选择,我全都要)\n"); scanf("%d",&answer1); if(answer1==3) printf("请补充说明你的想法:\n"); else if(answer1==2) printf("你确定吗?小老鼠又有什么坏心思呢?\n"); else if(answer1==1){ printf("那么把一头大象放进冰箱需要几步?\n"); printf("4.3步\n"); printf("5.n步\n"); scanf("%d",&answer2); if(answer2==4) printf("clever!\n"); else if(answer2==5){ printf("建议选4呢亲\n"); getchar(); gets(words1); } getchar(); gets(words2); } return 0; } -----------------------------------------------------------------
标签:r4,r1,r2,r3,int,实验,printf,嘿嘿嘿 来源: https://www.cnblogs.com/nuistli/p/14540463.html