Algorithm
- Take Three Variables -
number1
,number2
and division. - Assign values on
number1
andnumber2
. - Make
division = number2 / number1
. - Print
division
's value.
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
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
50 5
Output
Division = 10
#3 Code with only two variables and Input
Code -
C Programming
#include <stdio.h>
int main(){
float number1, number2 = 0;
printf("Enter Number 1: ");
scanf("%f", &number1);
printf("Enter Number 2: ");
scanf("%f", &number2);
printf("Division = %.3f\n", number2 / number1);
return 0;
}
Copy The Code &
Try With Live Editor
Input
Enter Number 1: 10
Enter Number 2: 50
Enter Number 2: 50
Output
Division = 5.000
Demonstration
Simple Division Program Example in C Programming.
Are you very beginners in Coding ? Let's try in Junilearning -
https://junilearning.com/
[It's a very popular Coding platform for Junior level programmers.]