#include<stdio.h>
//tabee
//parametre Num be mabnaye b beravad va dar araye DestArray gharar begirad.
void ConvertBase10(int Num, int b, int *DestArray)
{
	int i;
	for(i=0; Num > 0; i++)
	{
		DestArray[i] = Num % b;
		Num /= b;
	}
}

int main()
{
	int i, Base, Number10, DestArray[30] = {0};
	printf ("adad mabnaye 10 ra vared konid : ");
	scanf("%d", &Number10);
	printf ("adad mabnaye maghsad (2 ya 8)) ra vared konid : ");
	scanf("%d", &Base);
	ConvertBase10(Number10, Base, DestArray);
	for(i=29; DestArray[i] == 0 && i >= 0; i--)
		;
	printf ("Natije = ");
	for(; i >= 0; i--)
		printf("%d", DestArray[i]);
	getch();
}

