C C++ program to show input output in array

C C++ program to show input output in array

C Language में Structure क्या होता है और इसका प्रयोग क्यो किया जाता है जानने के लिए देखें—Structures in C

C Language में Array और इसके विभिन्न प्रकारो के बारे में और अधिक जानने के लिए देखें— Arrays in C

C Language के बारे में अधिक जानने के लिए देखें—Brief Introduction of C

C program to show input output in array

#include<stdio.h>
int main()
{
    int num[5],i;
    printf("Enter five numbers: ");
    for(i=0;i<5;i++)
    {
        scanf("%d",&num[i]);
    }
    for(i=0;i<5;i++)
    {
        printf("Number = %d\n",num[i]);
    }
    return 0;
 }

C++ program to show input output in array

#include<iostream>
using namespace std;
int main()
{
    int num[5],i;
    cout<<"Enter five numbers: ";
    for(i=0;i<5;i++)
    {
        cin>>num[i];
    }
    for(i=0;i<5;i++)
    {
        cout<<"Number = "<<num[i]<<endl;
    }
    return 0;
 }

Output of C C++ program to show input output in array

C C++ program to show input output in array

Similar array based programs in C C++

  1. Declaration and initialization of array
  2. Sum and average of array elements
  3. Largest Element in Array
  4. Smallest element in Array
  5. Reverse Elements of Array
  6. Merging two arrays
  7. Searching in array (Linear search)
  8. Sorting in array (Selection sort)
  9. Pointer to array
Share it to:

Published by

admin

I am a computer teacher, programmer and web developer