2019年12月16日
摘要: 分析: 输入——变量x,y存放输入的两个整数; 输出——变量m存放输入的两个整数的最大值,m为输出; 算法——如果x比y大,x赋给m,否则y赋给m。 #include<stdio.h>void main(){ int x,y,m; scanf("%d%d",&x,&y); if(x>y) m=x; 阅读全文
posted @ 2019-12-16 19:55 张德明 阅读(990) 评论(0) 推荐(0)
摘要: #include<stdio.h>void main(){ float a; printf("Input the value:"); scanf("%f",&a); if(a>0) printf("area=%f\n", a*a);} 阅读全文
posted @ 2019-12-16 19:44 张德明 阅读(418) 评论(0) 推荐(0)
摘要: #include<stdio.h>void main(){ int x,y; scanf("%d", &x); printf("x=%d\n",x); y=x; if(x<0); y=-x; printf("|%d|=%d",x,y);} 阅读全文
posted @ 2019-12-16 19:39 张德明 阅读(2007) 评论(0) 推荐(0)
摘要: #include<stdio.h>void main(){ char ch; ch=getchar(); ch == 'y' || ch == 'Y' ? printf("yes") : printf("no");} 阅读全文
posted @ 2019-12-16 19:30 张德明 阅读(3226) 评论(0) 推荐(0)
摘要: #include<stdio.h>void main(){ char ch; ch=getchar(); printf("%c",ch);} 阅读全文
posted @ 2019-12-16 19:24 张德明 阅读(1068) 评论(0) 推荐(0)
摘要: #include<stdio.h>void main(){ int a, area; scanf("%d",&a); //等待用户从键盘输入一个整数// area=a*a; printf("The area is %d\n",area); //将变量area的值输出到屏幕上去//} 阅读全文
posted @ 2019-12-16 19:19 张德明 阅读(842) 评论(0) 推荐(0)
摘要: #include<stdio.h>void main(){ int a, area; a=3; area=a*a; printf("The area is %d\n",area);} 阅读全文
posted @ 2019-12-16 19:12 张德明 阅读(2204) 评论(0) 推荐(0)
摘要: #include<stdio.h>void main(){ int i=2; float j=3.14; printf("i=%f,j=%d\n",(float)i,(int)j);} 阅读全文
posted @ 2019-12-16 19:03 张德明 阅读(109) 评论(0) 推荐(0)
摘要: #include<stdio.h>void main(){ printf("Type int has a size of %u byte,",sizeof(int)); printf("Typelong has a size of %u byte,",sizeof(long));} 阅读全文
posted @ 2019-12-16 18:56 张德明 阅读(304) 评论(0) 推荐(0)