Division in C

In the below program is the division of two numbers, the user is need to enter two numbers and the input is fetched using the pre-defined function scanf() and stored in the variables a and b. Then, the variables a divided by the variable b and the result is stored in the variable c.

Here a and b are declared as integer datatype and c declared as float datatype.

Below is the division of two numbers program in C:

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
float c;
clrscr();
printf("\n\n\t\t\tDIVISION\n\nEnter the two number: ");
scanf("%d%d",&a,&b);
c=a/b;
printf("\nQuotient= %f",c);
getch();
}

 

Leave a Reply