DO NOT MISS

Ads

Sunday, 3 July 2016

Input Functions in C-Programming



Computer takes some information into the user this information is called input.



Assigning the values to Variable:-
We can assign the values to Variables in two ways.


There are two ways to assign the values of Variables in Static time.
1. Variable initialization
2. Variable assignment
1. Variable initialization:-
Assigning the values to Variables at the time of the Variable declaration is called Variable initialization.

Syntax :- Data type variable name=value;
Ex:- int a=10;


* Write a program to initialize integer value to a Variable.


#include<stdio.h>

#include<conio.h>

void main()

          {

          clrscr();

          int a=10,b=15;

                     printf("the value of a is:%d",a);

                     printf("the value of b is:%d",b);

          getch();

          }
Output:-

the value of a is:10
the value of b is:15

2. Variable Assignment :-
Assigning the values to Variables after the Variable declaration is called Variable Assignment. 

Syntax :- Data type variable name;
                 Variable name=value;

Ex:- int a;
         a=10;


* Write a program to Assign integer value to a Variable.

   #include<stdio.h>

   #include<conio.h>

   void main()

          {

          clrscr();

                 float a,b;

                 a=10.85;

                 b=20.67;

                        printf("the value of a is:%f",a);

                        printf("the value of b is:%f",b);

                getch();

         }
Output:-

the value of a is:10.85
the value of b is:20.67
__________________________________________________________________________________
__________________________________________________________________________________

Greataims

 
Copyright © 2016 Computersadda. Designed by @ Computersadda Team - Published By Greataims