Advertisement
lokhun

Untitled

Jan 22nd, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.64 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. //2.16
  8.     int x {0};
  9.     int y{0};
  10.     int sum {0};
  11.     int product {0};
  12.     int difference {0};
  13.     int quotient {0};
  14.  
  15.     cout << " Enter your two integer: " ;
  16.     cin >> x >> y;
  17.     cout << "The sum is: " << x + y << endl;
  18.     cout << "The product is:" << x * y << endl;
  19.     cout << "The difference is: " << x - y << endl;
  20.     cout << "The quotient is: " << x % y << endl;
  21.    
  22. //2.20
  23.     double r{0.0};
  24.     double x{3.14159};
  25.  
  26.     cout << "Enter your radius: ";
  27.     cin >> r;
  28.  
  29.     cout << "The circle's diameter is: " << 2 * r << endl;
  30.     cout << "The circumference is: " << 2 * x * r << endl;
  31.     cout << "The area is: " << x * r * r << endl;
  32.    
  33. //2.28
  34.     int number;
  35.  
  36.     cout << "Enter a five-digit number: ";
  37.     cin >> number;
  38.  
  39.     cout << number / 10000 << " ";
  40.     number = number % 10000;
  41.     cout << number / 1000 << " ";
  42.     number = number % 1000;
  43.     cout << number / 100 << " ";
  44.     number = number % 100;
  45.     cout << number / 10 << " ";
  46.     number = number % 10;
  47.     cout << number << endl;
  48.    
  49. //2.30
  50.     int weight;
  51.     int height;
  52.     int BMI;
  53.  
  54.     cout << "Enter your weight in pounds: ";
  55.     cin >> weight;
  56.  
  57.     cout << "Enter your height in inches: ";
  58.     cin >> height;
  59.  
  60.     BMI = (weight *703) / (height * height);
  61.  
  62.     cout << "Your BMI values is: " << BMI << endl;
  63.     cout << "\nBMI VALUES" << endl;
  64.     cout << "Underweight: less than 18.5\n";
  65.     cout << "Normal:      between 18.5 and 24.9\n";
  66.     cout << "Overweight:  between 25 and 29.9\n";
  67.     cout << "Obese:       30 or greater\n";
  68.  
  69.     return 0;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement