Variables:-Variables are temporary memory locations that we use to work with mathematical values .
example-:int a,b,c;
in c variables must belong to a data type.

data types in c
in c data type is a property that we add to our variables and finally our variables and finally our variables begin to behave like that data type


the main data types in c are the following.

1-:integer-:to store integer values.
2-:float-:to store fractional values.
3-:character-:to store character values.






however c supports the following data types in all.

working with data types:-In c language data types are used especially in declaring variables .avariable must belong to a data type


declaration of variables
when we start main function our first task is to declare variables

synatax-:[datatype][set of variables];

example-:

int a,b,c;

here int is a data type



rules for creating variable names
-:variables name can be alphanumeric but the start of variables names can never be numeric

-:only dash is allowed(_)
-:keyword can never be used as variables.
-:since c is a case sensitive language we should avoid capital letters




assigning values to variables

syntax-:
int a;
a=32000;
float x;
x=3.7;


char z;
z='*';


write a cprogram for calculating si
#include< stdio.h>
#include< conio.h>
void main()
{
int p,t;
float r,si;
p=6000;
t=3;
r=7.8;
si=(p*r*t)/100;
printf("the si is %f",si); getch();
}




displaying values of variables

when we have to display the value of a variaable we will have to use the printf statement in a different way

syntax-:

printf(" ", )



example-:
int a;
float b;
printf("%d%f",a,b);



write a program that input three sides of a triangle and displays the area of the triangle-:

#include< stdio.h>
#include< conio.h>
void main()
{

float a,b,c,s,ar;
a=15;
b=10;
c=5;
s=(a+b+c)/2;
ar=(s*(s-a)*(s-b)*(s-c));
ar=sqrt(ar);
printf("the area is %f",ar);
getch();
}


write a program to convert celsius to fahreinheit


#include< stdio.h>

#include< conio.h>

void main()
{
float c,f;
printf("enter the temperature in celsius");
scanf("%f",&c);
f=(9*c+160)/5;
printf("the temperature in fahrenheit is %f",f);
getch();
}






write a program to calculate roots of quiadritic equation>



#include
#include
void main()
{
int x,y;
float a,b,c,alp,bit;
a=3;
b=8;
c=4;
x=(b*b)-(4*a*c);
y=sqrt(x);
alp=((-b)+y)/(2*a);
bit=((-b)-y)/(2*a);
printf("the value of alpha is %f",alp);
printf("the value of alpha is %f",bit);
getch();
}