#include <stdio.h>
int main() {
int a=5, b=6, c=100, d, e, f;
d=a/b*c;
e=a*c/b;
f=c/b*a;
printf("d=%d, e=%d, f=%d\n",d,e,f);
return 0;
}
#include <stdio.h>
int main(){
int x=123.456;
float f=123.456;
double m=123.456;
char ch='a';
char a[]="hi world!";
int y=4,z=5;
printf("%d %d\n",y,z);
printf("y=%d, z=%d\n",y,z);
printf("%8d,%2d\n",x,x);
printf("%f,%8f,%8.1f,%0.2f,%.2e\n",f,f,f,f,f);
printf("1f\n",m);
printf("%3d\n",ch);
#include <stdio.h>
int main() {
double x,y;
char c1,c2,c3;
int a1,a2,a3;
scanf("%d%d%d",&a1,&a2,&a3);
printf("%d%d%d\n",a1,a2,a3);
scanf("%c%c%c",&c1,&c2,&c3);
printf("\'%c\'\'%c\'\'%c\'\n",c1,c2,c3);
scanf("%lf,%lf",&x,&y);
printf("%lf,%lf\n",x,y);
return 0;
}
![]()
#include <stdio.h>
int main() {
char x;
x = getchar();
if(x>='a'&&x<='z')
printf("%cis word character\n",x);
else if(x>='0'&&x<='9')
printf("%cis number character\n",x);
else printf("%cis others",x);
return 0;
}
![]()
![]()
![]()
#include <stdio.h>
int main() {
char ans1,ans2;
printf("Have you reviewed? (y/Y is yes n is no):");
ans1 = getchar();
getchar();
printf("\n手动敲代码?(y/Y is yes n is no):");
ans2 = getchar();
if (ans1=='y'||ans1=='Y'&&ans2=='y'||ans2=='Y')
printf("\nRoma was not built in one day:)\n");
else
printf("\nRoma was not distroyed in one day...\n");
return 0;
}
![]()
#include <stdio.h>
#include<math.h>
int main() {
int n,sum;
scanf("%d",&n);
sum=pow(2,n)-1;
printf("n=%d时,sum=%d\n",n,sum);
return 0;
}
![]()
printf("%s\n%15s\n%10.5s\n%2.5s\n%.3s\n",a,a,a,a,a);
return 0;
}