Course C Initial – 3rd Variables Part. 2
Lesson
3 Part.
2.
Now,
as promised, I present for you the last part of variables. In this
lesson, we’ll learn to store a variable with the commands in the
language. Well, let’s go so.
First,
see the C program structure below:
In
this code, we can see that it ask to user type a number, so after, we
see ‘scanf’ this is the command to read and stored to a variable
in C. Between parentheses, we have a control string ‘%i’, after
the ‘&’ symbol and the variable name. So, scanf structure is:
scanf(“%control_string”,&variable_name); below, see this
table with some data types control strings.
Now,
we can see create codes with this knowledge. Test them in your
compiler because the practice is the way to learn and be a
programmer. So, copy this code in your compiler:
This
algorithm ask the user’s tall and print it. Write this algorithm in
your compiler and test how many times you want. Below, see an
example:
So,
test theses algorithms in your compiler. In the next lesson, we see
an exercises list do practice what was looked up to here.
Well,
that’s all folks!
See
you later!
Comentários
Postar um comentário