C++ Program to calculate the division of two numbers. | सी ++ प्रोग्राम दो नंबरों के विभाजन की गणना करने के लिए।






















C++ Program to calculate the division of two numbers.

Let see the program division two numbers.


Example:
  1. Declare two variables they are integer data types x, y, and store the value
    in z then declares a float data type.

  2. Declare one int data type and one float datatype, then store float data type.

  3. Declare two float data type, then store float data type.

  4. Declare two integer data types, then store float data type.

  5. Input x=10,y=5

  6. Then z=x/y

  7. Division two numbers z=2

  8. Input x=15,y=10.5

  9. Then z=x/y

  10. Division two numbers z=1.428571428571429

  11. Input x=10.5,y=15

  12. Then z=x/y

  13. Division two numbers z=0.7

  14. Input x=20.5,y=10.7

  15. Then z=x/y

  16. Division two numbers z=1.91588785046729





#include <iostream> using namespace std; int main() { int number1,number2; float div; cout<<"Enter First number :"; cin>>number1; cout<<"Enter second number :"; cin>>number2; div=number1/number2; cout<<" Division of two numbers :"<<div<<endl; return 0; }

Output:

Enter First number :10 Enter second number:7 Multiplication of two numbers:1.428571



#include <iostream> using namespace std; int main() { int number1,number2,div; cout<<"Enter First number :"; cin>>number1; cout<<"Enter second number :"; cin>>number2; div=number1/number2; cout<<" Division of two numbers :"<<div<<endl; return 0; }

Output:

Enter First number:10 Enter second number:7 Multiplication of two numbers:1 Note:

Declare two variables they are integer data types x, y, and store the value in z then declares a int data type.

For example x=10 and y=7 then a division of two numbers (z=x/y) z=1.428571 but z declare int data type then store z=1.



#include <iostream> using namespace std; int main() { float number1,number2,div; cout<<"Enter First number :"; cin>>number1; cout<<"Enter second number :"; cin>>number2; div=number1/number2; cout<<" Division of two numbers :"<<div<<endl; return 0; }

Output:

Enter First number :3.5 Enter second number:2.7 Division of two numbers:1.2963