4.5
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
void main() {
int a = 5, b = 7;
float x = 67.8564, y = -789.124;
char c = ‘A’;
long n = 1234567;
unsigned u = 65535;
printf(“%d%d\n”,a,b);
printf(“%3d%3d\n”, a, b);
printf(“%f,%f\n”, x, y);
printf(“%-10f,%-10f\n”, x, y);
printf(“%8.2f,%8.2f,%.4f,%.4f,%3f,%3f\n”,x,y,x,y,x,y);
printf(“%e,%10.2e\n”,x,y);
printf(“%c,%d,%o,%x”,c,c,c,c);
printf(“%ld,%lo,%x\n”,n,n,n);
printf(“%u,%o,%x,%d\n”,u,u,u,u);
printf(“%s,%5.3s\n”,“COMPUTER”,“COMPUTER”);
}
4.8 设圆半径r=1.5,圆柱高 h=3,求圆周长、圆面积、圆球表面积、圆球体积、圆柱体积。用scanf输入数据,输出计算结果,输出时要求有文字说明,取小数点后2位数字。请编程序。
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define PI 3.14
void main() {