#include<stdio.h>
int main(){
int num;
scanf("%d",&num);
printf("2049%04d\n",num);
scanf("%d",&num);
printf("2049%04d\n",num);
scanf("%d",&num);
printf("2049%04d\n",num);
return 0;
}
![](https://img2020.cnblogs.com/blog/2328395/202104/2328395-20210401160630229-2053814989.jpg)
#include<stdio.h>
int main(){
int x=1234;
float f=123.456;
double m=123.456;
char ch='a';
char a[]="Hello,world!";
int y=3,z=4;
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("3c\n",ch);
printf("%s\n%15s\n%10.5s\n%2.5s\n%.3s\n",a,a,a,a,a);
return 0;
}
![](https://img2020.cnblogs.com/blog/2328395/202104/2328395-20210401162158858-2044831386.jpg)
#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%c\n",c1,c2,c3);
scanf("%1f,%1f",&x,&y);
printf("%1f,%1f\n",x,y);
return 0;
}
![](https://img2020.cnblogs.com/blog/2328395/202104/2328395-20210401164137793-1952449271.jpg)
#include<stdio.h>
int main(){
char ans1,ans2;
printf("复习了没?(输入y或y表示复习了,输入n或N表示没有复习):");
ans1=getchar();
getchar();
printf("\n动手敲代码了没?(输入y或Y表示敲了,输入n或N表示木有敲):");
ans2=getchar();
if((ans1=='y'||ans1=='Y')&&(ans2=='y'||ans2=='Y'))
printf("\n罗马不是一天建成的:)\n");
else
printf("\n罗马不是一天毁灭的。。。\n");
return 0;
}
![](https://img2020.cnblogs.com/blog/2328395/202104/2328395-20210401165614926-1856984812.jpg)
#include<stdio.h>
int main(){
char x;
x=getchar();
if(x>='0'&&x<='9')
printf("%c是数字字符\n",x);
else if(x>='a'&&x<='z'||x>='A'&&x<='Z')
printf("%c是英文字母\n",x);
else
printf("%c是其它字符\n",x);
return 0;
}
![](https://img2020.cnblogs.com/blog/2328395/202104/2328395-20210401170845964-1050777911.jpg)
![](https://img2020.cnblogs.com/blog/2328395/202104/2328395-20210401170853146-1828312938.jpg)
![](https://img2020.cnblogs.com/blog/2328395/202104/2328395-20210401170901410-1595077666.jpg)
#include <stdio.h>
int main() {
int n,sum,s,m;
sum=1;
s=1;
m=1;
scanf("%d",&n);
while(m<=n){
s=s*2;
m=m+1;
sum=sum+s;
}
printf("n等于%d时,sum=%d",n,sum);
return 0;
}
![](https://img2020.cnblogs.com/blog/2328395/202104/2328395-20210401171600438-101123100.jpg)
![](https://img2020.cnblogs.com/blog/2328395/202104/2328395-20210401171614046-135377482.jpg)