Sunday, 7 August 2016

DIFFERENT TYPE OF " DATA TYPE " CONVERSION IN C

#include <stdio.h>
main()
{
 int e = 17, f = 5;
 double PI;
 PI = (double) e / f;
 printf("Value of PI : %f\n", PI );

 int i = 17;
 char c = 'c';    /* ascii value is 99 */

 int a;
 a = i + c;
 printf("Value of a : %d\n", a );
 float b;
 b = i + c;
 printf("Value of b : %f\n", b );
}

output :
Value of PI : 3.400000
Value of a : 116
Value of b : 116.000000

No comments:

Post a Comment

smhjifrivly@gmail.com