1、輸入函數(shù)scanf的參數(shù)錯(cuò)誤,應(yīng)該為:scanf("%f",&k);
2、|1234 1234 |
3、ff10
4、1,3,1
5、原字符串
左邊加空格再加字符串本省,字符個(gè)數(shù)總和為5個(gè)
6、scanf("%d,%d,%c,%c",&a1,&a2,&c1,&c2);
7、printf("a+b=%d\n",a+b);
printf("a-b=%d\n",a-b);
printf("a*b=%d\n",a*b);
printf("a/b=%d\n",a/b);
printf("(float)a/b=%f\n",(float)a/b);
printf("a%b=%d\n",a%b);
8、void main()
{
float r;
float s,c;
printf("please input the number:");
scanf("%f",&r);
if(r>=0)
{
s = 3.14*r*r;
c = 2*3.14*r;
printf("s = %f, c = %f\n",s,c);
}
else
printf("you input number is error!");
}
9、void main()
{
int n;
printf("please input the number:");
scanf("%d",&n);
if(n>=100 && n <= 999)
printf("%d%d%d",n%10,(n/10)%10,n/100);
else
printf("you input number is error!");
}
10、void main()
{
int i,j,k;
scanf("%d,%d,%d",&i,&j,&k);
((i%2 != 0?1:0) + (j%2 != 0?1:0)+(k%2 != 0?1:0)) == 2?printf("YES\n"):printf("NO\n");
}
11、void main()
{
char a;
scanf("%c",&a);
printf("%c,%c,%c",a-1,a,a+1);
printf("%d,%d,%d",a-1,a,a+1);
}
12、void main()
{
float a,b,c,s,Area;
scanf("%f,%f,%f",&a,&b,&c);
if(a+b > c || a+c > b || b+c >a)
{
s = (a+b+c)/2;
Area = sqrt(s*(s-a)*(s-b)*(s-c));
printf("%f\n",Area);
}
else
printf("you input the number is error!\n");
}