Blog Moved

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

Search This Blog

21 Jul 2012

C Program for Division

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


PROGRAM:


#include<stdio.h>
#include<conio.h>
int main()
{
     int x,y;
     int result1,result2;
     printf("\n Enter the dividend : ");
     scanf("%d",&x);
     printf("\n Enter the divisor: ");
     scanf("%d",&y);
     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);
     getch();
     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