if(n>99999999) place=9;
else if(n>9999999) place=8;
else if(n>999999) place=7;
else if(n>99999) place=6;
else if(n>9999) place=5;
else if(n>999) place=4;
else if(n>99) place=3;
else if(n>9) place=2;
else place=1;
printf("%ld\n",place);
}
[题目1018:数的排序]
3,6,9
参考程序:
#include<stdio.h>
main()
{ int a,b,c,t;
scanf("%d,%d,%d",&a,&b,&c);
if(a>b) {t=a;a=b;b=t;}
if(a>c) {t=a;a=c;c=t;}
if(b>c) {t=b;b=c;c=t;}
printf("%d,%d,%d",a,b,c);
}
参考程序:
#include <stdio.h>
main()
{ char a,b,c,d,e;
scanf("%c%c%c%c%c",&a,&b,&c,&d,&e);
if(a<='Z'&&a>='A') a=a+32;
if(b<='Z'&&b>='A') b=b+32;
if(c<='Z'&&c>='A') c=c+32;
if(d<='Z'&&d>='A') d=d+32;
if(e<='Z'&&e>='A') e=e+32;
printf("%c%c%c%c%c",a,b,c,d,e);
}
#include "stdio.h"
main()
{ int a,b,c,d,e;
scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
if(a%27==0) printf("YES\n");else printf("NO\n");
if(b%27==0) printf("YES\n");else printf("NO\n");
if(c%27==0) printf("YES\n");else printf("NO\n");
if(d%27==0) printf("YES\n");else printf("NO\n");
if(e%27==0) printf("YES\n");else printf("NO\n");
评论0
最新资源