c how to program 习题2.25

c how to program 习题2.25

//c how to program 习题2.25 #include <stdio.h> int main(void) { printf(" P\n"); printf(" P\n"); printf("PPPPPPPPP\n"); printf(" P\n"); printf(" P\n\n"); printf(" PPPP\n"); printf(" P P\n"); printf(" ...

c how to program 习题2.24

c how to program 习题2.24

//c how to program 习题2.24 #include <stdio.h> int main(void) { int x; printf("请输入一个整数:"); scanf("%d", &x); if(x%2 == 0){ printf("%d是一个偶数\n", x); } if(x%2 != 0){ printf("%d是一个奇数\n", x); } }

c how to program 习题2.23

c how to program 习题2.23

//c how to program 习题2.23 #include <stdio.h> int main(void) { int a, b, c, d, e; printf("请输入5个不同的整数:"); scanf("%d%d%d%d%d", &a, &b, &c, &d, &e); int smallest, largest; if(a > b){ largest = a; smalle ...

c how to program 习题2.21

c how to program 习题2.21

//c how to program 习题2.21 #include <stdio.h> int main(void) { printf("********* *** * *"); printf("\n"); printf("* * * * *** * *"); printf("\n"); p ...

c how to program 习题2.20

c how to program 习题2.20

//c how to program 习题2.20 #include <stdio.h> int main(void) { int r; printf("请输入半径:"); scanf("%d", &r); printf("直径是:%d\n", r*2); printf("周长是:%f\n", 2*3.14159*r); printf("面积是:%f\n", 3.14159*r*r); }

c how to program 习题2.19

c how to program 习题2.19

//c how to program 习题2.19 #include <stdio.h> int main(void) { int x, y, z; printf("请输入三个不同的整数:"); scanf("%d%d%d", &x, &y, &z); printf("Sum is %d\n", x+y+z); printf("Average is %d\n", (x+y+z)/3); printf("Produce ...

c how to program 习题2.18

c how to program 习题2.18

//c how to program 习题2.18 #include <stdio.h> int main(void) { int x, y; printf("请输入两个整数:"); scanf("%d%d", &x, &y); if(x > y){ printf("%d is larger\n", x); } if(x < y){ printf("%d is larger\n", y); } if(x == y ...

c how to program 习题2.17

c how to program 习题2.17

//c how to program 习题2.17 #include <stdio.h> int main(void) { printf("1 2 3 4\n\n"); printf("%d %d %d %d\n\n", 1,2,3,4); printf("1 "); printf("2 "); printf("3 "); printf("4\n"); }

c how to program 习题2.16

c how to program 习题2.16

//c how to program 习题2.16 #include <stdio.h> int main(void) { int x, y; printf("请分别输入两个整数:"); scanf("%d%d",&x,&y); printf("它们的积是:%d\n", x*y); printf("它们的和是:%d\n", x+y); printf("它们的商是:%d\n", x/y); p ...

c how to program 习题2.4

c how to program 习题2.4

//c how to program 习题2.4 #include <stdio.h> int main(void) { int x, y, z; printf("请分别输入三个整数:"); scanf("%d%d%d", &x,&y,&z); int result=x*y*z; printf("这三个整数的积是:%d\n", result); }