How do I scan a floating variable?

I know that if I want to scan an integer-type
variable, I must use the %d. For example, on this program:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>
#include <stdlib.h>

int main () {
   int year, g;
   printf ("Enter a year: \n");
   scanf("%d", &year);
   g=(year+1)%19;
   printf ("Year's Golden Number is %d\n", g);
      
   system ("PAUSE");
   return 0;

}


But then if a want to scan a floating or char or boolean type variable,
what should I do?
Last edited on
There's a list of format flags here:
http://www.cplusplus.com/reference/cstdio/printf/
Last edited on
Thanks a lot. I've searched in the site, but I couldn't find it.
Topic archived. No new replies allowed.