Hi people. I'm new in this C programming issue and I have had some problems. It happens with Code::Blocks. When I complete my project and run the program it has no problem. I can type in the data, numbers, letters or whatever to make it work, but once I press Enter it jumps to a new line and does nothing at all. I even have to close the window with the X. I have an example with a basic program that finds a quotient and the rest with two numbers the user chooses. I don't know if it is a problem with the IDE or with my hideous coding, but I'd appreciate if you could give me a hand. Thanx.
Code:
#include <stdio.h>#include <conio.h>
void div(int a, int b)
{
int i,result=0,rest=0,p;
for(i=1;i=a;i++)
if((i*b)<a)
result=i;
else
p=result*b;
rest=a-p;
printf("The quotient is %d and the reminder is %d",result,rest);
return;
}
int main()
{
int a,b;
printf("Please type the dividend: \n");
scanf("%d",&a);
printf("Now, type the divisor. REMEMBER TO CHOOSE A SMALLER NUMBER: \n");
scanf("%d",&b);
div(a,b);
return 0;
}