How to Take Multiple Input in C? Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report 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 CTo take multiple inputs from users in C, we can declare an array to store the user input and repeatedly call the scanf() 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 fgets() function can be used to read strings with spaces. C Program to Take Multiple Inputs from the UserThe below program demonstrates how we can take multiple inputs from the users in C. C // C Program to Take Multiple Inputs from User #include <stdio.h> int main() { // Declare variables to hold the number of integers and // loop index int n, i; // Prompt the user to enter the number of inputs they // want to enter printf( "Enter the number of integers you want to input: "); scanf("%d", &n); // Declare an array of size n to hold the integers int arr[n]; printf("Enter %d integers:\n", n); // Loop to read n integers from the user for (i = 0; i < n; i++) { scanf("%d", &arr[i]); } // Print the integers entered by the user printf("You entered:\n"); for (i = 0; i < n; i++) { printf("%d ", arr[i]); } printf("\n"); return 0; } Output Enter the number of integers you want to input: 5Enter 5 integers:1020304050You entered:10 20 30 40 50 Time Complexity: O(N), here N denotes the number of inputs.Auxiliary Space: O(N) Create Quiz Comment A abhay94517 Follow 0 Improve A abhay94517 Follow 0 Improve Article Tags : C Programs C Language c-input-output C Examples Explore C BasicsC Language Introduction6 min readIdentifiers in C3 min readKeywords in C2 min readVariables in C4 min readData Types in C3 min readOperators in C8 min readDecision Making in C (if , if..else, Nested if, if-else-if )7 min readLoops in C6 min readFunctions in C5 min readArrays & StringsArrays in C4 min readStrings in C5 min readPointers and StructuresPointers in C7 min readFunction Pointer in C5 min readUnions in C3 min readEnumeration (or enum) in C5 min readStructure Member Alignment, Padding and Data Packing8 min readMemory ManagementMemory Layout of C Programs5 min readDynamic Memory Allocation in C7 min readWhat is Memory Leak? How can we avoid?2 min readFile & Error HandlingFile Handling in C11 min readRead/Write Structure From/to a File in C3 min readError Handling in C8 min readUsing goto for Exception Handling in C4 min readError Handling During File Operations in C5 min readAdvanced ConceptsVariadic Functions in C5 min readSignals in C language5 min readSocket Programming in C8 min read_Generics Keyword in C3 min readMultithreading in C9 min read Like