All New

user:thomas gists created by user

title:mygist gists with given title

description:sync gists with given description

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

all:systemctl search all fields

Login

All New Login

All gists

Recently created
Least recently created
Recently updated
Least recently updated
myceliatrix's Avatar

myceliatrix / Is even

0 likes
0 forks
1 files
Last active 6 hours ago
A generator that spits out a massive amount of C for a useless task
shitposts python c generator
1 import sys
2
3 def generate_subfunction(file, start, end):
4 file.write(f"int is_even_{start}_{end}(int num) {{\n")
5 conditions = ""
6 for i in range(start, end + 1):
7 even_check = "1" if i % 2 == 0 else "0"
8 conditions += f"(num == {i}) ? {even_check} : "
9 conditions += "0"
10 file.write(f" return {conditions};\n")
Newer Older

Powered by Opengist ⋅ Load: 16ms⋅

日本語
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文