VOOZH about

URL: https://www.geeksforgeeks.org/c/multiple-input-in-c/

⇱ How to Take Multiple Input in C? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to Take Multiple Input in C?

Last Updated : 23 Jul, 2025

In C, we use scanf to take input from the user, and often it is necessary to take multiple inputs simultaneously. In this article, we will learn about how to take multiple inputs from the users in C.

Multiple Inputs From a User in C

To take multiple inputs from users in C, we can declare an array to store the user input and repeatedly call the function within loop to keep taking the inputs until required. While reading strings as inputs the user may encounter spaces, to deal with them the function can be used to read strings with spaces.

C Program to Take Multiple Inputs from the User

The below program demonstrates how we can take multiple inputs from the users in C.


Output

Enter the number of integers you want to input: 5
Enter 5 integers:
10
20
30
40
50
You entered:
10 20 30 40 50

Time Complexity: O(N), here N denotes the number of inputs.
Auxiliary Space: O(N)

Comment