Home / Programs / C Program to Print Array Elements
🚀 Programming Example

C Program to Print Array Elements

👁 1,392 Views
💻 Practical Program
📘 Step Learning
Print Array Elements

💻 Program Code

 
#include<stdio.h>
 
int main() {
   int i, arr[50], num;
 
   printf("\nEnter no of elements :");
   scanf("%d", &num);
 
   //Reading values into Array
   printf("\nEnter the values :");
   for (i = 0; i < num; i++) {
      scanf("%d", &arr[i]);
   }
 
   //Printing of all elements of array
   for (i = 0; i < num; i++) {
      printf("\narr[%d] = %d", i, arr[i]);
   }
 
   return (0);
}
                        

🖥 Program Output


Enter no of elements :4

Enter the values :1
2
3
4

arr[0] = 1
arr[1] = 2
arr[2] = 3
arr[3] = 4 
                            

📘 Explanation

Print Array Elements
📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.