Saturday, 3 October 2015

How to use value and its variable in c programming

How to use value and its variable in c programming

.................................................................................................................................
...............................................................................................................................
This c tutorial is shown to all computer beginner to get understood how to use variable to calculate the value of two digit number in c program.In a c tutorial where we can store value in variable,here we have shown   how to store value in a variable and get actual result will print in c language.

So This is simple calculation for any two digit number in c programming.Lets check out Subtraction,Multiplication and Division calculation using two variable  >>>>>>




In this program we have assigned two variable and take one extra variable to store value of two variable.We have given an example in this c programming video tutorial how to calculate any two digit number using variable.So now we have also explanation this program in this following below.Now we have shown how to write this program in c language :

For example we can assume and take two variable and also extra variable;

Here we have taken two variable one is a and other is b and we also take one extra variable to sotre the result of a and b.In c programming we can declare this way:
{
int a=5,b=8; // Assign the value of a and b.
int c;
c=a-b;
c=a*b;
c=a/b;
printf("\n Subtraction =%d",c);
printf("\n Multiply =%d",c);
printf("\n Division =%d",c);
}

In this program we have assigned value fixed in a and b variable.It means that it is also called static variable,because we have already set the value of a and b.Static variable is always fixed in programming.we can't change the variable value.

Static variable example ;

{
int a=5; // Assign static variable
int b=8;
}

We can also declare this variable using dynamic way. Here we have given an example about dynamic variable.Dynamic variable value can be change in any time in programming.Lets see our dynamic variable example;

Dynamic variable example :

{
int a; // Assign dynamic variable
int b;
}
In this way we can declare variable in c programming.We have also taken third variable its named c where the value of a and b is store using operator .Lets check out our example to store value in third variable.

How to store value in variable in c programming :

{
int a=5;
int b=8;
c=a-b; // use operator (-)
}

Output :
Result store in c variable



No comments:

Post a Comment