单片机重点作业题答案整理(8)
发布时间:2021-06-07
发布时间:2021-06-07
printf("\n"); while(1); }
结果: 8 9 9 8 8 9 8 7 7 8 8 7
(2)#include <stdio.h>
extern serial_initial();main() {
int x,y,z;
serial_initial();
printf("input data x,y?\n"); scanf("%d %d",&x,&y);
printf("\n x y x<y x<=y x>y x>=y x!=y x==y"); printf("\n");
printf("\n%3d%3d",x,y);
z=x<y; printf("%5d",z); z=x<=y; printf("%5d",z); z=x>y; printf("%5d",z); z=x>=y; printf("%5d",z); z=x!=y; printf("%5d",z); z=x==y; printf("%5d",z); while(1); }
执行结果:
input data x,y? 1 2
x y x<y x<=y x>y x>=y x!=y x==y 1 2 1 1 0 0 1 0 (3)#include <stdio.h> extern serial_initial(); main() {
int x,y,z;
serial_initial();
printf("input data x, y ?\n"); scanf("%d %d",&x,&y);
printf("\n x y !x x||y x&&y"); printf("\n%3d%3d",x,y);
z=!y; printf("%5d",z); z=x||y; printf("%5d",z); z=x&&y; printf("%5d",z); printf("\n");printf("\n"); printf("That is all\n"); while(1); }
执行结果:
input data x, y ?
x y !x x||y x&&y 1 2 0 1 1 That is all
上一篇:义务劳动心得体会3000
下一篇:2014职称英语词汇选项集锦