### Communities

Challenges

+3
−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!

Why does this post require moderator attention?
Why should this post be closed?

+2
−0

# Japt, 4 bytes

P1 is:

+"+U


Try it

Which outputs P2, where N1 is the input from P1:

N1+U


Try it

Why does this post require moderator attention?

+2
−0

# VyxalṪ, 3 bytes

?\?


Try it Online!

Outputs N1?, which when run with the same flag as P1, will add the two inputs together.

Try it Online!

Why does this post require moderator attention?

+2
−0

main=do a<-getLine;putStr$"main=getLine>>=print.("++a++"+).read"  Try it online! Run both programs Why does this post require moderator attention? You might want to add some details to your flag. #### 0 comment threads +1 −0 # C (gcc), 87 bytes P1: i;main(){scanf("%d",&i);printf("i;main(){scanf(\"%%d\",&i);printf(\"%%d\",%d+i);}",i);}  Try it online! Generated P2 for input 10: i;main(){scanf("%d",&i);printf("%d",10+i);}  Try it online! Why does this post require moderator attention? You might want to add some details to your flag. #### 0 comment threads +1 −0 # Ahead, 10 bytes IO"@O+I"W@  This prints N1I+0@. Try it online! Why does this post require moderator attention? You might want to add some details to your flag. #### 0 comment threads +1 −0 # Python 3, 58 39 bytes P1: print(f"print(int(input())+{input()})")  Try it online! P2 (given I inputted 10, 30 22 bytes): print(int(input())+10)  Try it online! Why does this post require moderator attention? You might want to add some details to your flag. #### 1 comment thread 39 bytes (1 comment) +0 −0 # Rockstar, 40 bytes listen to N say "listen to N say N-0+"+N  Which outputs P2, where X is the input from P1: listen to N say N-0+X  Try it here (Code will need to be pasted in) Why does this post require moderator attention? You might want to add some details to your flag. #### 0 comment threads +0 −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!

Why does this post require moderator attention?

28 bytes (1 comment)
+0
−0

# Lua, 51 bytes

P1:

print("print(tonumber(io.read())+"..io.read()..")")


Try it online!

P2 (given I inputted 10, 29 bytes):

print(tonumber(io.read())+10)


Try it online!

Why does this post require moderator attention?