Monday 2 January 2017

C Program to Swap Two Numbers

Program:
This program is saved as Swap.c

Output:

Sunday 1 January 2017

C Program to find greatest of three numbers

Program:
This program is saved as GreatestOfThree.c

Output:

C Program to Add n numbers

Program:
This program is saved as Add.c

Output:

C Program to Add Subtract Multiply and Divide the numbers

Program:
This program is saved as AddSubMulDiv.c 
Type casting is a way to convert a variable from one data type to another data type. For example, if you want to store a long value into a simple integer then you can type cast long to int. You can convert values from one type to another explicitly using the cast operator.

New data type should be mentioned before the variable name or value in brackets which to be typecast.

Converting an expression of a given type into another type is known as type-casting . typecasting is more use in c programming language.

It is best practice to convert lower data type to higher data type to avoid data loss.

Data will be truncated when higher data type is converted to lower. For example, if float is converted to int, data which is present after decimal point will be lost.

Output: