C Tutorial Part 2- Numeric Variables

C Tutorial Part 2-Numeric Variables


 This is the second tutorial blog on C .

If you haven't checked out my first one, go to-https://cercomp.blogspot.com/2019/02/c-tutorial-part-1-hello-world.html

Today I will be discussing numeric variables.Every programming language has the ability to create and operate with numeric variables. In C, almost 80% of the logic requires the usage of different variables such as character, string, and numeric variables.


An example of using numeric variables is to add two numbers in an application.


So let's get started-
PS:You can tap or click on images to see them better.

1. Use the #include <stdio.h> header file.

2. Type int main () {}

3. Now lets type int a;

The int syntax defines or shows that the value, or values next to it are numeric variables.(a) is the variable formed. A variable in computer terms is an area in the system memory which contains a value we don't know. As this was function, their will be a semicolon in the end.





4. Write a=5;
This shows that value inside variable (a) is 5.

5. Type printf ("%d\n",a);
return 0;
We are using the printf statement to display text. %d is used to represent a numeric variable while displaying or taking input. Don't worry, the %d sign simply represents the value of (a)(after the commas), which is 5. This statement displays the value inside a, which is 5. (\n is used to leave a line)
I included return 0; as I didn't want to make this to complicated.
(return 0; closes the application).




Now simply compile and your result is below







You can also try this-




and this is the result-



Next blog will be there soon!



Comments

  1. Wonderful job!! Keep writing...๐Ÿ‘Œ๐Ÿ‘Œ

    ReplyDelete
  2. Thanks for this valuable blog. It was very informative and interesting. Keep sharing this kind of stuff.
    Matlab Training in Chennai
    HTML5 Training in Chennai
    Matlab Course in Chennai
    HTML5 Courses in Chennai

    ReplyDelete

  3. This blog contains good information which adds additional knowledge about the topic.
    Linux Course In Chennai
    Learn Linux Online

    ReplyDelete

Post a Comment

Popular Posts