Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include "pch.h"
- #include <iostream>
- #include <iomanip>
- #define K_TO_M 0.6214
- #define M_TO_K 1.6093
- int main()
- {
- double n = 1, k;
- std::cout << "Input k: ";
- std::cin >> k;
- std::cout << "Mili | KM" << std::endl;
- if (k >= 0) {
- std::cout << std::setprecision(4) << std::fixed;
- for (double i = 1; i <= ceil(k); i++)
- {
- if (i / 1.609344 < n) {
- printf("%.4f %.4f\n", i / 1.609344, i);
- }
- else {
- if (n*1.609344 <= k) {
- printf("%.4f %.4f\n", n, n*1.609344);
- }
- if (i <= k) {
- printf("%.4f %.4f\n", i / 1.609344, i);
- }
- n++;
- }
- }
- }
- else {
- std::cout << "Enter more than 0" << std::endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement