Input and Output

I/O Multiple Values

Here’s how you can take multiple inputs from the user and display them.

#include <stdio.h>
int main()
    int a;
    float b;

    printf("Enter integer and then a float: ");
    // Taking multiple inputs
    scanf("%d%f", &a, &b);

    printf("You entered %d and %f", a, b);  
    return 0;


Enter integer and then a float: -3
You entered -3 and 3.400000

Leave a Reply

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