Simple Division Program Example in C Programming

Algorithm


  1. Take Three Variable, number1, number2, summation.
  2. Assign values on number1 and number2.
  3. Make division= number2 / number1.
  4. Print divisionvalue.

Code Examples

#1 Simple Division Program in C

Code - C Programming

#include <stdio.h>
int main(){
  float division = 0;
  float number1 = 100, number2 = 200;
  division = number2 / number1;
  printf("Division = %f\n",  division);
  return 0;
}
Copy The Code & Try With Live Editor

Output

x
+
cmd
Division = 100

#2 Simple Division in C with Input

Code - C Programming

#include <stdio.h>
int main(){
  float division = 0;
  float number1, number2 = 0;
  printf("Enter Number 1: ");
  scanf("%f", &number1);
  printf("Enter Number 2: ");
  scanf("%f", &number2);
  division= number2 / number1;
  printf("Division = %.3f\n",  division);
  return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
50 5

Output

x
+
cmd
Division = 10

Demonstration


Simple Division Program Example in C Programming