Tuesday, December 29, 2015

Example 4 : Print Simple Number With It's Square.


   >>> Example 4 : Print Simple Number With It's Square.

           #include<iostream.h>

            int main(void)
                 
                  {

                      double x = 0.0;

                       // it's good practice to initialize all variables by assigning a value.

                       cout << " Please enter a number: ";
                       cin >> x;

                        cout << " You Entered " << x <<', whose square is " << x*x << endl;

                         return 0;
               
                     }

   

No comments:

Post a Comment