Problem 1. Times 2  START HERE
Try out this test problem first.
Given the variable x as your input, multiply it by two and put the result in y.
Examples:
Input x = 2 Output y is 4
Input x = 17 Output y is 34
Solution Stats
Problem Comments

121 Comments
Why does y = bitshift(x,1); give a larger solution size than the most common answer listed so far?
The first problem. Very easy but enough to start the Cody Game. Great game!
@Sam Nazari
I guess it`s because calling bitshift makes the code size bigger. You call a function.
When there is only x*2 its 1 operation only.
Deceivingly easy start to the game!
Ha ha I got it
Great!
I did in fact start here.
Good problem for beginners.
Nice!!!
Yeah
cool
alright
I tried to use bitshift but I forgot it doesn't work with x<0
Easy starter problem. Except I was expecting Cody, to require a '.m' file upload.
very basic,very interesting indeed
test
Very interesting!
good for newcomers
interesting
interesting!
good questionsss
1st try :)
like
ez
GG
nice
nice
good job
good job
nice
good
ok
This is the best way to start using Cody
This is the best problem to start using Cody.
Instructions say to press the "Solve This Now!" button, but there is no such button...
good
grade
I submitted the following, which works in my version of matlab, but it found errors and said it wasn't valid:
function y = times2(x)
% Modify the line below so that the output y is twice the incoming value x
y = bitsll(x,fi(1));
% After you fix the code, press the "Submit" button, and you're on your way.
end
The beginning of the dream!
this is nice..
Smooth
What is the meaning of these axises
nice...
No one can solve this.
Hardest problem ever.
nice problem
a new starting
Nice problem
Nice
Nice problem for beginners
nice
Great for test, like Hello world.
Nice
good
nice
well done)
good
good
good
good
good
good
good
Good
Ans:y=x.^2;
">
test
Search for multiplication techniques on MATLAB if you can't get the answer.
multiply
nice
easy
so easy
Nice
Easy one
rly easy
almost stumped me
We can do it
nice
nice
great
Why was a function statement needed here?
The problem is simple enough but I am afraid you are losing others interest by putting a function inside the code.
A simpler code would provide the same context, but with less confusion why a function statement is given.
epic
nice!
too much fun
cool
Addicted! lol
clapped
The solution size just doesn't make sense. We need a new metric.
very good
best problem I've ever met
Easy one ?
Very simple problem.
this was nice way to learn how to use cody
Moderately difficult questions
Nice
Good basic question
Awesome
Nice!
Reminded me of scalar multiplication in MATLAB thanks
Solid intro to Cody.
Good starting problem!
Good for starting. Anyway, it took me some time to figure out what to do.
Quite decent for entry
Good problem to start!
Really easy start to Cody challenge
Nice Easy start
amazing problem to do
Nice starting problem
Great
Good beginner problem!
great!
tester
authorized comment
Hiei
This is a private group
Hi you have been hacked
Good starting problem!
good first problem
good problem to start with
good problem to start with
lol good problem，
Solution Comments
Show commentsProblem Recent Solvers100145
Suggested Problems

Given an unsigned integer x, find the largest y by rearranging the bits in x
1807 Solvers

Given a window, how many subsets of a vector sum positive
851 Solvers

Duplicate each element of a vector.
603 Solvers

466 Solvers

Calculate the average value of the elements in the array
1154 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!