#include
int main()
{
int year;
scanf("%d",&year);
int flag = 0;
if(0 == year % 4)
{
if(0 == year % 100)
{
if(0 == year % 400)
{
flag = 1;
}
}
else
{
flag = 1;
}
}
if(1 == flag)
{
printf("this year = %d is leap\n",year);
}
else
{
printf("this year = %d is not leap\n",year);
}
return 0;
}
#include
int main()
{
char op;
float a,b;
scanf("%f%c%f",&a,&op,&b);
switch(op)
{
case '+':
printf("=%5.2f\n",a+b);
break;
case '-':
printf("=%5.2f\n",a-b);
break;
case '*':
printf("=%5.2f\n",a*b);
break;
case '/':
if(0 == b)
{
printf("b = 0\n");
}
else
{
printf("=%5.2f\n",a/b);
}
break;
default:
printf("op is error\n");
}
return 0;
}
#include
int main()
{
int score;
scanf("%d",&score);
score /= 10;
if(score < 0 || score > 10)
{
printf("input is error\n");
}
else
{
switch(score)
{
case 10:
case 9:
printf("A");
break;
case 8:
printf("B");
break;
case 7:
printf("C");
break;
case 6:
printf("D");
break;
default:
printf("E");
break;
}
printf("\n");
}
return 0;
}
#include
int main()
{
int i = 0;
int sum = 0;
int t = 1;
int n;
scanf("%d",&n);
for(i = 1;i <= n;i++)
{
t *= i;
sum += t;
}
printf("sum = %ld\n",sum);
return 0;
}
#include
int main()
{
int num;
scanf("%d",&num);
int i;
int count = 0;
for(i = 2;i < num;i++)
{
if(0 == num % i)
{
count++;
}
}
if(0 == count)
{
printf("True : %d\n",num);
}
else
{
printf("False : %d\n",num);
}
return 0;
}
#include
int main()
{
int i,j;
int count = 0;
int n = 0;
for(i = 100;i <= 200;i++)
{
count = 0;
for(j = 2;j < i;j++)
{
if(0 == i % j)
{
count++;
}
}
if(0 == count)
{
printf("%4d",i);
n++;
if(0 == n % 4)
{
printf("\n");
}
}
}
printf("\n");
return 0;
}
#include
int main()
{
int i;
int count = 0;
for(i = 100;i <= 200;i++)
{
if(0 == i % 3)
{
//continue;
}
else
{
printf("%d ",i);
count++;
}
if(0 == count % 5)
{
printf("\n");
}
}
printf("\n");
return 0;
}
#include
int main()
{
int i;
int n;
int temp;
int count = 0;
scanf("%d",&n);
for(i = 0;i <= n;i++)
{
temp = i;
while(0 != temp)
{
if(9 == temp % 10)
{
count++;
}
temp /= 10;
}
}
printf("count = %d\n",count);
return 0;
}
#include
int main()
{
int i;
char killer;
int sum;
for(i = 0;i < 4;i++)
{
killer = 'A' + i;
sum = (killer != 'A') + (killer == 'C') + (killer == 'D') + (killer != 'D');
if(3 == sum)
{
printf("killer is %c\n",killer);
break;
}
}
return 0;
}
#include
int main()
{
int a[10] = {10,9,8,7,6,5,4,3,2,1};
int len = sizeof(a) / sizeof(int);
int i,j;
int min;
for(i = 0;i < len -1;i++)
{
min = i;
for(j = i+1;j < len;j++)
{
if(a[j] < a[min])
{
min = j;
}
}
if(min != i)
{
int temp = a[i];
a[i] = a[min];
a[min] = temp;
}
for(j = 0;j < 10;j++)
{
printf("%d ",a[j]);
}
printf("\n");
}
return 0;
}
#include
int main()
{
int a[10] = {10,9,8,7,6,5,4,3,2,1};
int len = sizeof(a) / sizeof(int);//10
int i,j;
for(i = 0;i < len-1;i++)
{
for(j = 0;j < len-i-1;j++)
{
if(a[j] > a[j+1])
{
int temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
}
}
for(j = 0;j < 10;j++)
{
printf("%d ",a[j]);
}
printf("\n");
}
return 0;
}