The scanf function in C

#include <stdio.h>

int main()
{
    printf("Please enter a single character: ");
    char c;
    scanf("%c", &c);
    printf("You entered: %c\n", c);

    printf("Please enter an integer number : ");
    int i;
    scanf("%d", &i);
    printf("You entered integer value: %d\n", i);

    printf("Please enter an integer and a double: ");
    int x;
    double g;
    scanf("%d %lf", &x, &g);
    printf("You entered int value : %d and double : %lf\n", x, g);
    return 0;
}

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *