C Program to Find Quotient and Remainder

Hello coders, in this post we will how to write C Program to Find Quotient and Remainder. This is a very basic C program.

As you already know that this site does not contain only c programming solutions here, you can also find the solution for other problems. I.e. Web Technology, Data StructuresRDBMS ProgramsJava Programs Solutions,  Fiverr Skills Test answersGoogle Course AnswersLinkedin AssessmentLeetcode Solutions, and Coursera Quiz Answers.

C Program to Find Quotient and Remainder
C Program to Find Quotient and Remainder

if you want to learn C programming free of cost please visit:

C Program to Find Quotient and Remainder

#include <stdio.h>
int main(){
   int num1, num2, quot, rem;

   printf("Enter dividend: ");
   scanf("%d", &num1);

   printf("Enter divisor: ");
   scanf("%d", &num2);

   /* The "/" Arithmetic operator returns the quotient
    * Here the num1 is divided by num2 and the quotient
    * is assigned to the variable quot
    */
   quot = num1 / num2;

   /* The modulus operator "%" returns the remainder after
    * dividing num1 by num2.
    */
   rem = num1 % num2;

   printf("Quotient is: %d\n", quot);
   printf("Remainder is: %d", rem);

   return 0;
}

Output

Enter dividend: 17
Enter divisor: 2
Quotient is: 8
Remainder is: 1

Conclusion

I hope after going through this post, you understand how to write C Program to Find Quotient and Remainder, if there is any case program is not working and showing an error please let me know in the comment section.

Sharing Is Caring

Leave a Comment