Data type,input and output of C language ( part -1 ) tutorial -6


hey friends how are you? hope all you are fine at this moment. you have already guess that today what topic i will discuss .
yes today i will discuss about data type input output of C language and this is the basic .

variable:
a program can have different type of variable . variable is nothing but a identifier that a name. it can be character or underscore . example a,b,c,c_a,a123 etc. that our programs can manipulate.

 Basic type of variables :


1. Integer
2. Float
3. Double
4. Char
5. void

we will discuss about all variable in next time when we will implement it.
today i will discuss about Integer type of variable and some kind of its operation .

Integer : integer is nothing but a single number or natural number . 1 2 3 4 5 6 7..........N all are integer .

now we please give attention here.. open your codeblocks and type this code and run it what you will show it can give you a result . so go to the code and show some example of it.

i have already mention with comment line that which line works what purposes.
in 4th line we have declared integer type of variable. in 5th line and 6th line have given value what you want to give. then operation of summation . and this value will assign in c . finally we have printed it. here %d is for integer . that value will of c.
after run the program you will see like this

Output:


now i will show you addition subtraction multiplication and division at a time .
you can try it on your codeblocs with different type of value.

Code:
#include<stdio.h>
int main()
{
    int a,b,summation,subtruction,multiplication,division;//integer number variable
    a=40; //value
    b=8; //value
    summation=a+b; // summation of two number
    subtruction=a-b;
    multiplication=a*b;
    division=a/b;
    printf("the summation is : %d\n",summation);
    printf("the subtraction is : %d\n",subtruction);
    printf("the multiplication is : %d\n",multiplication);
    printf("the division is : %d\n",division);
    return 0;
}

Output:

here you are showing that i have used \n this means a new line after a line finished . if you don't give it so the output will show in a line. you can try it without \n .

thank you guys see you again in next tutorial about data type , input,output of c language part - 2 . if you have any query about it and any problem please comment in bellow .

Data type,input and output of C language ( part -1 ) tutorial -6 Data type,input and output of C language ( part -1 )  tutorial -6 Reviewed by Saroar Zahan Sojib on March 02, 2019 Rating: 5

No comments:

ads
Powered by Blogger.