C Program to Perform Division of Two Integers

 


C Program to Perform Division of Two Integers





// C program to perform division of two integers
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter first number:\n");
scanf("%d",&a);

printf("Enter second number:\n");
scanf("%d",&b);
c=a/b;
printf("Output\n");
printf("The division of two numbers is:%d\n",c);
printf("End of program");
}


Enter first number:

20

Enter second number:

10

Output

The division of two numbers is:2

End of program




// C program to perform division of two integers
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter two numbers:\n");
scanf("%d%d",&a,&b);
c=a/b;
printf("Output\n");
printf("The division of two numbers is:%d\n",c);
printf("End of program");
}


Enter two numbers:

20 10

Output

The division of two numbers is:2

End of program



// C program to perform division of two integers
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter two numbers:\n");
scanf("%d%d",&a,&b);
printf("Output\n");
printf("The division of two numbers is:%d\n", a/b);
printf("End of program");
}


Enter two numbers:

20 10

Output

The division of two numbers is:2

End of program


In the above program division of two numbers is not stored in any variable. Direct division process has been takes place in printf() function.

टिप्पणी पोस्ट करा

0 टिप्पण्या