#include
main(){
int a,b;
printf("请输出两个数字:");
scanf("%2d%3d",&a,&b);
printf("前:%d%d",a,b);
int c;
c=a;a=b;b=c;
printf("后:%d%d",a,b);
return 0;
}
#include
main()
{
double a;
printf("请输入一个double型数据:");
scanf("%lf",&a);
a= (a*100+0.5)/100;
printf("%0.2lf",a);
}
#include
main()
{
int a;
printf("请输入成绩:");
scanf("%d",&a);
switch(a/10)
{
case 10:printf("等级为:A");break;
case 9:printf("等级为:A");break;
case 8:printf("等级为:B");break;
case 7:printf("等级为:C");break;
case 6:printf("等级为:D");break;
default:printf("等级为:E");break;
}
}
#include
main()
{
int i=1,sum=0;
while(sum<=1000)
{
sum=sum+i;
i++;
}
printf("%d",--i);
}
#include
main()
{
char c='a';
char a;
scanf("%c",&a);
printf("%c\n%c",a,c);
}
#include
main()
{
char ch;
int i;
for(i=0;i<26;i++)
{
ch=i+65;
printf("c=%c,ASCII=%d\n",ch,ch);
}
}
#include
main()
{
double a,b;
scanf("%lf%lf",&a,&b);
printf("%0.2lf",a+b);
}
#include
double add(double a,double b)
{
double s;
s=a+b;
return s;
}
main()
{
double m,n,z;
scanf("%lf%lf",&m,&n);
z=add(m,n);
printf("%.2lf",z);
}
#include
void try(int ,int ,int);
main()
{
int x=2,y=3,z=0;
printf("x=%d y=%d z=%d\n",x,y,z);
try(x,y,z);
printf("x=%d y=%d z=%d\n",x,y,z);
}
void try(int x,int y,int z)
{
printf("x=%d y=%d z=%d\n",x,y,z);
z=x+y;
x=x*x;
y=y*y;
printf("x=%d y=%d z=%d\n",x,y,z);
}
#include
void swap(int,int);
main()
{
int x=10,y=20;
printf("x=%d y=%d\n",x,y);
swap(x,y);
printf("x=%d y=%d\n",x,y);
}
void swap(int a,int b)
{
int t;
printf("a=%d b=%d\n",a,b);
t=a;a=b;b=t;
printf("a=%d b=%d\n",a,b);
}
#include
isprime(int);
main()
{
int x;
printf("enter a integer number.");
scanf("%d",&x);
if(isprime(x))
printf("%d is prime\n",x);
else
printf("%d is not prime\n",x);
}
isprime(int a)
{
int i;
for(i=2;i<=a/2;i++)
{
if(a%i==0)
return 0;
else
return 1;
}
}
#include
#include
char myupper(char ch)
{
if(ch>='a'&&ch<='z')
ch=ch-32;
return ch;
}
main()
{
char c;
while((c=getchar())!='@')
{
c=myupper(c);
putchar(c);
}
}
#include
main()
{
char c;
int i=0;
while((c=getchar())!='@')
{
i++;
}
printf("%d",i);
}
#include
main()
{
int a,b,min,*pa,*pb,*pmin;
pa=&a;pb=&b;pmin=&min;
scanf("%d%d",&a,&b);
printf("a=%d,b=%d\n",a,b);
*pmin=*pa;
if(*pa>*pb)
*pmin=*pb;
printf("min=%d",min);
}
#include
int myadd(int *a,int *b)
{
return *a+*b;
}
main()
{
int x,y,z;
scanf("%d%d",&x,&y);
int *p,*q;
p=&x;q=&y;
z=myadd(p,q);
printf("%d",z);
}