C C++ program to show input output in array

Coding in C

#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;
 }

Coding in C++

#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;
 }
C C++ program to show input output in array

Published by

admin

I am a computer teacher, programmer and web developer