So, we saw multiplication of two numbers in our previous blog .Now we will see about division of two numbers.

Basic Data Type:- int, char, float, double

int Datatype:-Its an integer datatype .Its of 2 bytes .Its range is −32,768 to 32,767.

char Datatype:-Its an character datatype. Its of  1 byte. Its range is -128 to 127 .

float Datatype:-Its for floating point numbers. Its of  4 byte.

double Datatype :-Its for large floating point numbers .Its of 8 byte

1.Division of two numbers using the keyword int 

#include <stdio.h>

int main()

{

    int number1,number2,number3;

    printf("Enter two numbers ");

    scanf("%d %d",&number1,&number2);

    number3=number1/number2;

    printf("Quotient of the number is %d",number3);

    return 0;

}

Algorithm:-

1.Start 

2.Declare the header file #include<stdio.h>

3.Inside the main function declare the keyword int for the variables number1 ,number2,number3.

4.Use scanf and get the first number  and second number .For integer variable we have to use a format specifier "%d" .

scanf:-Its used to get the user input from the user .

Since we are using two integer variable we are using two format specifiers which is of integer type i.e,"%d".

5.Use the number3 variable and divide first number from second number .

6.Finally print the number3 variable .

7.Stop 

 Screenshot:-

1.Code Screenshot:-


2.Output Screenshot:-



2.Division of two numbers using float keyword.

#include <stdio.h>

int main()

{

    float number1,number2,number3;

     printf("Enter two numbers ");

    scanf("%f %f",&number1,&number2);

    number3=number1/number2;

    printf("Quotient of two numbers is %f",number3);

    return 0;

}

Algorithm:-

1.Start 

2.Declare the header file #include<stdio.h>

3.Inside the main function declare the keyword float for the variables number1 ,number2,number3.

4.Use scanf and get the first number  and second number .For float variable we have to use a format specifier "%f" .

scanf:-Its used to get the user input from the user .

Since we are using two float variable we are using two format specifiers which is of float type i.e,"%f".

5.Use the number3 variable and divide first number from second number .

6.Finally print the number3 variable .

7.Stop 

 Screenshot:-

1.Code Screenshot :-


2.Output Screenshot:-


3.Division of two numbers using double datatype.

#include <stdio.h>

int main()

{

    double number1,number2,number3;

   printf("Enter two numbers ");

    scanf("%lf %lf",&number1,&number2);

    number3=number1/number2;

    printf("Quotient of two numbers is %lf",number3);

    return 0;

}

Algorithm:-

1.Start 

2.Declare the header file #include<stdio.h>

3.Inside the main function declare the keyword double for the variables number1 ,number2,number3.

4.Use scanf and get the first number  and second number .For double variable we have to use a format specifier "%lf" .

scanf:-Its used to get the user input from the user .

Since we are using two double variable we are using two format specifiers which is of double type i.e,"%lf".

5.Use the number3 variable and divide first number from second number .

6.Finally print the number3 variable .

7.Stop 

 Screenshot:-

1.Code Screenshot:-


2.Output Screenshot:-



In the next blog we will see how to get remainder of two numbers.