fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6. int main() {
  7. // your code goes here
  8. double a, b, h;
  9. cin >> a >> b>> h;
  10. for(double x = a; x <= b; x += h){
  11. cout << fixed << setprecision(3) <<x<< " " << 3 * sin(x) << endl;
  12. }
  13. return 0;
  14. }
Success #stdin #stdout 0s 4488KB
stdin
-1 -3 1
stdout
-3.000 -0.423
-2.000 -2.728
-1.000 -2.524