Use the %lf
format specifier to read a double:
double a; scanf("%lf",&a);
Wikipedia has a decent reference for available format specifiers.
You’ll need to use the %lf
format specifier to print out the results as well:
printf("%lf %lf",a,b);
Related Posts:
- How to do scanf for single char in C
- How do you allow spaces to be entered using scanf?
- Difference between fgets and fscanf?
- Difference between scanf() and fgets()
- Going through a text file line by line in C
- How to initialize array to 0 in C?
- Sign extend a nine-bit number in C
- Break statement not within loop or switch in C
- How to properly malloc for array of struct in C
- Cache Simulator in C
- Where is the C auto keyword used?
- make: Nothing to be done for `all’
- Data argument not used by format strings in C
- expected expression before ‘{‘ token
- Setting std=c99 flag in GCC
- C Vector/ArrayList/LinkedList
- Convert char array to a int number in C
- Bind failed: Address already in use
- Warning/error “function declaration isn’t a prototype”
- What is the difference between %f and %lf in C?
- warning: initializer element is not computable at load time
- What is stdin in C language?
- How to prevent multiple definitions in C?
- How to pass 2D array (matrix) in a function in C?
- error: ‘for’ loop initial declarations are only allowed in C99 mode [duplicate]
- How can you print multiple variables inside a string using printf?
- c – warning: implicit declaration of function ‘printf’
- C dynamically growing array
- Why should we check WIFEXITED after wait in order to kill child processes in Linux system call?
- How to compile makefile using MinGW?
- Mapping a numeric range onto another
- Why are hexadecimal numbers prefixed with 0x?
- Portable way to check if directory exists [Windows/Linux, C]
- too many arguments for format [-Wformat-extra-args]
- Incorrect checksum for freed object on malloc
- Scanning Multiple inputs from one line using scanf
- How to copy a char array in C?
- Simple way to check if a string contains another string in C?
- What does “request for member ‘*******’ in something not a structure or union” mean?
- cast to pointer from integer of different size, pthread code
- Invalid type argument of unary ‘*’ (have ‘int’) Error in C
- Segmentation fault (core dumped) due to fgets – I think
- Why do I get “cast from pointer to integer of different size” error?
- C subscripted value is neither array nor pointer nor vector when assigning an array element value
- What does “request for member ‘*******’ in something not a structure or union” mean?
- Unknown ending signal when using debugger gdb
- Valgrind: invalid read of size 4 -> sigsegv, works fine without valgrind and in visual studio
- error: too few arguments to function `printDay’ (C language)
- How to convert integer to char in C?
- Is there a good Valgrind substitute for Windows?
- Where to find the complete definition of off_t type?
- struct has no member named
- Difference between “move” and “li” in MIPS assembly language
- printf not printing to screen
- Initializing array of structures
- Still Reachable Leak detected by Valgrind
- Assembly x86 – “leave” Instruction
- What is the difference between array and enum in C ?
- What is signed integer overflow?
- What does the term “empty loop” refer to exactly in C and C++?
- When to use const char * and when to use const char []
- What do numbers using 0x notation mean?
- What integer hash function are good that accepts an integer hash key?
- Can I create an Array of Char pointers in C?
- Does stack grow upward or downward?
- Convert Little Endian to Big Endian
- Excess elements of scalar initializer for pointer to array of ints
- X86 assembly – Handling the IDIV instruction
- error C2371: ‘functionname’ redefinition: different basic types
- How does one represent the empty char?
- Pause screen at program completion in C
- How to write to a file using open() and printf()?
- note: previous implicit declaration of ‘point_forward’ was here
- Can I define a function inside a C structure?
- Where is the
header file on Linux? Why can’t I find ? - What exactly is meant by “de-referencing a NULL pointer”?
- how use EOF stdin in C
- How to find EOF through fscanf?
- Why is the sizeof(int) == sizeof(long)?
- getc() vs fgetc() – What are the major differences?
- Can’t understand the working of getint() in C as per K&R
- Lua – Number to string behaviour
- How do you read scanf until EOF in C?
- Tokenizing strings in C
- How to allocate array of pointers for strings by malloc in C?
- Simple C scanf does not work? [duplicate]
- Realloc Invalid Pointer in C
- How to read from input until newline is found using scanf()?
- What tools are there for functional programming in C?
- typedef fixed length array
- Reading float using scanf in c
- “-bash: gcc: command not found” using cygwin when compiling c?
- In C, what exactly happens when you pass a NULL pointer to strcmp()?
- Reading float using scanf in c
- “-bash: gcc: command not found” using cygwin when compiling c?
- How to format strings using printf() to get equal length in the output
- In C, what exactly happens when you pass a NULL pointer to strcmp()?
- What are the differences between if, else, and else if?
- What do \t and \b do?
- Why and when to use static structures in C programming?