for(i=-100;i<=100;i=i+10)
{printf("%5d",ctof(i));
if (n==5) {n=0;printf("\n");
}
n++;}}
2 #include<stdio.h>
int fact(int a)
{int i,s=1;
for(i=1;i<=a;i++)
s=s*i;
return s;
}
void main()
{
int m,n,p;
scanf("%d,%d",&m,&n);
p=fact(m)/fact(m-n);
printf("p=%d\n",p);
}
3 #include<stdio.h>
float total(int a)
{int i;
float s=0;
for(i=1;i<=a;i++)
s=s+1.0/i;
return s;
}
void main()
{
int n;
float s; scanf("%d",&n); s=total(n); printf("s=%f\n",s);
} 4#include<stdio.h> int fn(int a,int n) {int i,s=0; for(i=1;i<=n;i++) {s=s+a;a=a*10;} return s;
}
void main()
{
int i,a,n,s=0; scanf("%d%d",&a,&n); for(i=1;i<=n;i++) s=s+fn(a,i); printf("s=%d\n",s);
}
5
#include "stdio.h"
#define INPUT(x,y) scanf("%d,%d",&x,&y)
#define FU(x,y) x%y
#define PR(a) printf("%d",a)
#define PRINT(a) PR(a);putchar('\n') void main()
{
int x,y;
INPUT(x,y); PRINT(FU(x,y));
}
6
#include "stdio.h"