Advertisement
bozhilov

Odd Even - 3liner - NOSYNCDEV

Nov 24th, 2022 (edited)
683
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | Jokes | 0 0
  1. f = open("main.cpp", "w"); f.write("""#include <iostream>\nint main() {\n\tint x;\n\tstd::cout << "Enter a number: "<<std::endl;\n\tstd::cin >> x;\n\t\n\tif(x == 0){\n\t\tstd::cout << "Number is even";\n\t}""");
  2. for x in range(1, 1000):odd_string = "odd" if x % 2 != 0 else "even";string_to_write = f"\telse if(x == {x}){{\n\t\tstd::cout << \"Number is {odd_string}\" << std::endl;\n\t}}\n";f.write(string_to_write);
  3. f.write("}\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement