1. #include <stdio.h>
main(){
int a=1 ;
int b=2;
printf("%d %d\n",a,b);
}
2. #include <stdio.h>
main(){
float a=1.23;
double b=2.56;
printf("%f %lf\n",a,b);
}
3. #include <stdio.h>
main(){
char c1='a';
printf("%c %d\n",c1,c1);
}
4. #include <stdio.h>
main(){
int a=6;
float b=7.68;
printf("%d\n",a+(int)b);
}
5. #include <stdio.h>
main(){
int a=6;
int b=2;
int c;
c=b;
b=a;
a=c;
printf("%d %d\n",a,b);
}
6. #include<stdio.h>
main(){
int a=1,b=2,c,d;
printf("输入长和宽:");
scanf("%d%d",&a,&b);
c=(a+b)*2;
d=a*b;
printf("周长是%d\n面积是%d",c,d);
}
1. #include<stdio.h>
main(){
int a;
float b;
char g;
scanf("%d,%f,%c",&a,&b,&g);
printf("%d\n%f\n%c",a,b,g);
}
2.
#include<stdio.h>
main(){
char a,v;
scanf("%c,%c",&a,&v);
printf("%d %d",a,v);
}
3. #include<stdio.h>
#define PI 3.14
main(){
float h,r,v;
scanf("%f%f",&r,&h);
v=PI*r*r*h;
printf("体积为:%.2f\n",v);
}
4.
#include<stdio.h>
main(){
int a,b,c,d;
scanf("%d",&a);
b=a%10;
c=a/10%10;
d=a/100;
printf("个位是%d 十位是%d 百位是%d",b,c,d);
}
5. #include<stdio.h>
main(){
char a,b;
scanf("%c",&a);
b=a-32;
printf("%c",b);
}
6.
#include<stdio.h>
main(){
int mub,zhaoling;
float danjia,nub,fukuan;
printf("请输入单价:");
scanf("%f",&danjia);
printf("请输入数量:");
scanf("%d",&mub);
nub=danjia*mub;
printf("总金额:%d",(int)(nub*0.8));
printf("输入付款金额:");
scanf("%f",&fukuan);
zhaoling=fukuan-(int)(nub*0.8);
printf("找零:%d",zhaoling);
}