How to create a function that multiplies the input (x)?



Hi! I’m using ide50 Linux with C++ and C. (I hope I said that right).
I am so new to programming, and I have an assignment for the course I’m taking that involves multiplying the input, and saying the answer in the output. It sounds pretty simple, but I am completely stumped on it. At this point in my learning to program journey, everything is foreign.

My best guess to creating a program with this type of function is this: oh, and I know it’s wrong because it doesn’t work lol.

#include <stdio.h>
#include <math.h>

int main(void)
    int i = 12
    printf("%d tokens.\n", i);

For the love of the remaining itsy bitsy cute little sliver of sanity in me (that was barely there to begin with), PLEASE HELP.

and thank you so much!


Your include statement is missing what you are trying to include. What are you trying include?

Also, you mentioned “multiplies the input(x)”, but multiply it times what?


Whoops, my include is:

#include <stdio.h>
#include <cs50.h) (my course)

Had it in my original program.

And multiplying the input by 12, and displaying in the output for example: (40 tokens)
rrr it sounds so simple! but I wasn’t taught exactly how to make this specific program.


Hmmm… what I included in my last posts are anonymous? whoops. I am including the course I am taking and the standard library.


Have you gone through the cs50 lectures? They explain how to get input pretty well. To multiply a number it’s as simple as int newNumber = oldNumber * 12.