精品文档
2.2 #include
float x=2.5,y=2.5,z=2.5; printf(\printf(\printf(\}
3.1(1)
#include
int a=12,b=3;
float x=18.5,y=4.6;
printf(\printf(\}
3.1(2)
#include
int x=32,y=81,p,q; p=x++; q=--y;
printf(\printf(\
}
3.2
#include
int x,b0,b1,b2,s; printf(\scanf(\b2=x/100;
b1=(x-b2*100)/10;//或(x0)/10;或x/10; b0=x; 精品文档
精品文档
s=b0*100+b1*10+b2; printf(\
} 3.3
#include
float rate=0.0225; float n,capital,deposit; printf(\scanf(\deposit=capital*pow(1+rate,n); printf(\} 3.4
#include
float a, b, c; double x, y;
printf(\
scanf(\x=(-b+sqrt(b*b-4*a*c))/(2*a); y=(-b-sqrt(b*b-4*a*c))/(2*a); printf(\}
习题4 4.1(1)
#include
char c1='a',c2='b',c3='c';
printf(\}
4.1(2)
#include
int a=12,b=15;
printf(\}
精品文档
精品文档
4.1(3)
#include
int a,b;
scanf(\printf(\}
4.2
#include
long a,b; float x,y;
scanf(\scanf(\printf(\printf(\} 5.1
#include
float a;
printf(\scanf(\if(a>=0) {
a=a;
printf(\} else {
a=-a;
printf(\} } 5.2
#include
int a;
printf(\scanf(\if(a%2==0) 精品文档
精品文档
{
printf(\ 是偶数\} else {
printf(\ 是奇数\}
} 5.3
#include
float a,b,c,s,area; printf(\
scanf(\if(a+b>c&&a+c>b&&b+c>a) {
s=(a+b+c)/2;
area=(float)sqrt(s*(s-a)*(s-b)*(s-c)); printf(\} else {
printf(\不是三角形\} } 5.4
#include
float a,b,c,x,y;
printf(\
scanf(\if(a==0) {
printf(\该方程不是一元二次方程\\n\}
if(b*b-4*a*c>0) {
x=(-b+sqrt(b*b-4*a*c))/(2*a); y=(-b-sqrt(b*b-4*a*c))/(2*a); printf(\}
else if(b*b-4*a*c==0) 精品文档