numbers in an array

Write a C++ program to enter numbers in an array and then print those numbers. Print the numbers in the same order as entered into an array

#include<iostream>
using namespace std;
int main(){
	//printing sequence
	int size = 3;
	double seq[size];
	cout<<"Enter three numbers"<<endl;
	for(int i=0;i<size;i++){
		cout<<"a["<<i<<"] : ";
		cin>>seq[i];
	}
	cout<<"The numbers are "<<endl;
	for(int i=0;i<size;i++){
		cout<<"a["<<i<<"] = "<<seq[i]<<endl;
	}
	return 0;
}

Leave a Reply