/*
 * This program demonstrates input features in C.
 * Author: David Janzen
 */
#include <stdio.h>

int main(void)
{
     char ch;
     int num;
     int num2;
     float realNum;

     /* Simple input */
     printf("Enter an int:");
     scanf("%d", &num);
     printf("You entered %d\n", num);

     printf("Enter a char:");
     scanf(" %c", &ch);              /* blank needed if whitespace allowed */
     printf("You entered %c\n", ch);

     printf("Enter a float:");
     scanf("%f", &realNum);
     printf("You entered %f\n", realNum);

     printf("Enter an int, I'll read up to four digits:");
     scanf("%4d", &num);
     scanf("%3d", &num2);
     printf("You entered %d\n", num);
     printf("You entered %d\n", num2);

     return 0;
}