//Program translation numbers to n system from decimal system
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
 ldiv_t lx;
int main(void)
{
int i,n,system,kol;
long int number,ost;
int rezult[1000];
kol=2;
 clrscr();
 printf("\n  Insert number please and system to convert: ");
 scanf("%ld %d",&number,&system);
 lx=ldiv(number,system);
 printf("\n %ld div %d = %ld remainder %ld",number,system,lx.quot,lx.rem);
 rezult[0]=lx.rem;
   for(i=1;lx.quot!=1;i++)
 {
 ost=lx.quot;
 lx=ldiv(lx.quot,system);
 printf("\n %ld div %d = %ld remainder %ld",ost,system,lx.quot,lx.rem);
 rezult[i]=lx.rem;
 if(kol>23)
	 {
	 printf("\nPress any key for continue ....");
	 getch();
	 kol=0;
	 }
 kol++;
 }
 rezult[i]=lx.quot;
 printf("\n  Answer: ");
 for(n=i;n>=0;n--)printf("%d",rezult[n]);
 getch();
 return(0);
}