Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Comments on A number adder, not a death adder

Parent

A number adder, not a death adder

+5
−0

Create a program P1 which takes as input a base 10 number N1 (the numbers for the variables are important). Given N1, P1 will print a program P2. P2 will take as input a base 10 number N2 and output N1+N2.

P1 and P2 have to be in the same language.

If your language doesn't have STDIN, for P1 and P2 you may specify a placeholder in your answer where the "input" would be.

The person who creates the shortest scoring program wins. Have fun, everyone!

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

Are [functions](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/P1i61LDFHIwHIUKnOq9XOS9D8n5yfV5yfk6qXk5@... (2 comments)
Post
+1
−0

PHP, 58 28 bytes

P1:

<?="<?=\$argv[1]+$argv[1];";

Try it online!

Golfed 30 bytes thanks to @Shaggy's advice.

P2 (given I inputted 10):

<?=$argv[1]+10;

Try it online!

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

28 bytes (1 comment)