Blog Moved

This website completely moved to new domain. For latest content, visit

Search This Blog

21 Jul 2012

C Program for Division

c program for explaining the division operation, for getting quotient and remainder..


int main()
     int x,y;
     int result1,result2;
     printf("\n Enter the dividend : ");
     printf("\n Enter the divisor: ");
     result1 = x/y;          /*it gives the quotient*/
     result2 = x%y;        /* it gives remainder*/
     printf("\n The Quotient is: %d ",result1);
     printf("\n The Remainder is: %d ",result2);
     return 0;

Sample Output: ( using GNU GCC Compiler with Code Blocks IDE )
Enter the dividend: 26
Enter the divisor: 5
The Quotient is: 5
The Remainder is: 1

No comments:

Post a Comment