C Program to find the division of two integer numbers

User enters integer values for variable a and b, divides the two values and stores it in variable 'divide'. The value stored at variable 'divide' is printed on the console. The case of 'divide-by-zero' is also handled as the value infinity is not handled by C programming language.


void main()
	int a, b, divide;
	printf("Enter two numbers:\n");
	scanf("%d", &a);
	scanf("%d", &b);
	if(b == 0)
		printf("Divide by zero error\n");
		divide = a / b;
		printf("Division of %d and %d is %d\n", a, b, divide);

Output 1

Enter two numbers:
a:	60
b:	3
Division of 60 and 3 is 20

Output 2

Enter two numbers:
a:	23
b:	0
Divide by zero error