//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
#include <stdio.h>
int main(void)
{
printf("********* *** * *");
printf("\n");
printf("* * * * *** * *");
printf("\n");
p ...
//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
#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
#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.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
#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);
}