好了,你看看
#include <stdio.h>
#define MAX 1000
int max;
int min;
int main()
{
int a;
char ch;
int i;
int Original[MAX+1];
double Inverted[MAX+1];
for (i=1;i<=MAX;i++)
{
ch=getchar();
fflush(stdin);
if (ch!='\n')
Original[i]=ch-'0';
else
{
a=i;
break;
}
Inverted[i]=1/double(Original[i]);
}
max=Original[1];
min=Original[1];
for (i=2;i<=a-1;i++)
{
if(Original[i]>max)
max=Original[i];
if (Original[i]<min)
min=Original[i];
}
printf("Original values:");
for (i=1;i<=a-1;i++)
printf("%d
",Original[i]);
printf("[%d]\n",max);
printf("Inverted values:");
for (i=1;i<=a-1;i++)
printf("%.2f
",Inverted[i]);
printf("[%.2f]\n",1/(double(min)));
return 0;
}