C language int to double type

C language int to double type

The range indicated by int is small, so we can use explicit conversion :

/*
Example: How to Convert int to  double in C language
*/

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char const *argv[]) {
    int i = 23;
    double d = (double)i;
    printf("%d\n",i);
    printf("%lf\n",d);

    return 0;

}
So‮:ecru‬www.lautturi.com
Created Time:2017-08-29 09:21:08  Author:lautturi