Home / Programs / Program to find division of two numbers.
🚀 Programming Example

Program to find division of two numbers.

👁 3,947 Views
💻 Practical Program
📘 Step Learning

In this program we will show you how to divide one number with another. Take two variable number1 and number1 and use division operator (/) to divide them and store it in another variable divResult, finally print the divResult variable using printf function to see the result.

Flow chart

Division flow chart
Figure:

To understand this example, you should have the knowledge of the following C programming topics:

  • C Data Types
  • C Variables, Constants and Literals
  • C Input Output (I/O)
  • C Programming Operators

💻 Program Code

#include"stdio.h"
 
 void main()
	{
	int number1, number2, divResult; 

	printf("Enter two no: ");
 	scanf("%d%d",&number1,&number2);

	divResult = number1 / number2;

        printf("Division result=%d \n", divResult);
    
}
                        

🖥 Program Output

Enter two no: 10 2
Division result=5
Press any key to continue . . .
                            

📘 Explanation

Algorithm

  • Step 1: Start
  • Step 2: Declare variable number1, number2 and divResult
  • Step 3: Read Variable number 1, number 2
  • Step 4: Perform operation (divResult?= number1/ number2)
  • Step 5: Print divResult?variable
  • Step 7: Stop
📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.