Phoenix_x

Ivelin

Oct 22nd, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream> //cout and cin
  3. #include <math.h> //sqrt
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     int x = -100;
  10.  
  11.     while (x <= 100) {
  12.         if (x < 0)
  13.         {
  14.             cout << sqrt(x * x + 1) << endl;
  15.         }
  16.  
  17.         else {
  18.             if (x == 20) {
  19.                 cout << "Cannot divide by 0" << endl;
  20.             }
  21.             else
  22.             {
  23.                 cout << (x + 10) / (x - 20) << endl;
  24.             }
  25.         }
  26.  
  27.         x = x + 10;
  28.     }
  29.  
  30.     system("pause"); // if you press f5 and not control f5,
  31. }
Advertisement
Add Comment
Please, Sign In to add comment