#include <stdio.h>
int main(void)
{
//4.1
//二
//(2)
/*
int n,s,i;
s=0;
scanf("%d",&n);
for(i=0;n>0;i++){
s=s+n%10;
n=n/10;
}
printf("%d %d\n",i,s);*/
//(3)
/*
int n,max,min,s,i;
printf("enter n:");
scanf("%d",&n);
printf("enter 4 numbers:");
max=min=scanf("%d",&s);
for(i=1;i<n;i++)
{
scanf("%d",&s);
if(max<s)
max=s;
else if(min>s)
min=s;
}
printf("max=%d min=%d\n",max,min); */
//(4)
//(4)
/*
int n,m,i,k,sq,flag,s;
s=k=0;
printf("Enter m,n:");
scanf("%d%d",&m,&n);
for(;m<=n;m++)
{
flag=1;/////每次假设m为质数
sq=sqrt(m);
for(i=2;i<=sq;i++)
{
if(m%i==0)
{
flag=0;
break;
}
}
if(flag){
k++;
s+=m;
}
}
printf("%d %d",k,s);*/
//4.2(2)
/*
int n,i,t,s;
printf("Enter n:");
scanf("%d",&n);
for(i=ceil(pow(10,n-1));i<ceil(pow(10,n));i++)
{
s=0;
for(t=i;t>=1;t=t/10){
//q=ceil(11);
s=s+ceil(pow(t%10,n));
}
if(s==i)
printf("%d\n",i);
}*/
//改错题
/*
int denominator,flag;
double eps,item,sum;
flag=1;
denominator=1;
sum=0;
printf("Enter eps:");
scanf("%lf",&eps);
do{
item=1.0*flag/denominator;
sum=sum+item; flag=-flag; denominator=denominator+3;
} while(fabs(item)>eps); printf("sum=%.6f\n",sum);*/
/*
int flag,i,j,m,n,s;
printf("Enter m,n:");
scanf("%d%d",&m,&n);
flag=0;
for(i=m;i<=n;i++){
s=0;////////////////
for(j=1;j<=i/2;j ++){
if(i%j==0){///////////
s=s+j;
}
}
if(i==s){
flag=1;
printf("%d=1",i);
for(j=2;j<=i/2;j++){
if(i%j==0){printf("+%d",j);}//////////
}
printf("\n");
}
}
if(flag==0){
printf("None\n");
}*/
return 0;
}
网友评论