Use sscanf to get and then double a number from the user : Double « Data Type « C Tutorial






#include <stdio.h> 

    int main() 
    {  
        char  line[100];  
        int   value;   

        printf("Enter a value: "); 

        fgets(line, sizeof(line), stdin);  

        sscanf(line, "%d", &value);

        printf("Twice %d is %d\n", value, value * 2);  

        return (0);

    }
Enter a value: 123
Twice 123 is 246








2.22.Double
2.22.1.Get size and address for a double
2.22.2.Use sscanf to get and then double a number from the user