Код:
#define N 12
#include <stdio.h>
void precise_division(int first,int second,int precision);
void main(void){
int x[N]={1,2,3,34,4,5,6,7,8,9,10,11};
//double b[N];
int i=0;
int result=x[i];
for(i++; i<N;i++)
if(x[i]>result)
result=x[i];printf("Maximum: %d\n",result);
if(result !=0){
for (i=0; i<N;i++)
//b[i]=(double)x[i]/(double)result;
precise_division(x[i],result,20);
}
}
void precise_division(int first,int second,int k){
int c=0;
int ost;
int tmp;
int cnt=0;
int t=0;
tmp=first;
if(first>=second)
while (first>=second)
{
first-=second;
c++;
}
else if (first<second)
c=0;
if(first==0)
printf ("first/second = %d\n",c);
else
{
first=tmp;
printf ("first/second = %d,",c);
ost=first%second;
while(cnt<k)
{
if( ost<second)
{
if (t>=1)
{
printf ("0");
cnt++;
}
t++;
ost*=10;
}
else
{
printf("%d",ost/second);
ost%=second;
cnt++;
t=0;
}
}
}
printf ("\n");
}