problem with code for converting decimal to other bases
when i give any input, a window appears saying "a problem has occured, windows needs to close"
i cant understand what im doing wrong here.
any help will highly appreciated :)
this is my code:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
int ip_num,ip_base,op_num,op_base,i=0, acc[10];
char base_digits[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
printf("enter the input number:\n");
scanf("%d",& ip_num);
printf("choose the base to convert to:");
scanf("%d",& op_base);
for(i=0;i<9;i++)
{
if(ip_num==0)
break;
acc[i]=(ip_num % op_base);
ip_num=ip_num/op_base;
}
for(i;i>=0;i--)
{
printf("%c",base_digits[acc[i]]);
}
}