Home vector CPP program to initialize an array with consecutive numbers CPP program to initialize an array with consecutive numbers Author - Suman Barik October 06, 2022 0 // CPP program to initialize an array with consecutive// numbers#include <iostream>#include <numeric>using namespace std;int main(){ int arr[5]; iota(arr, arr + 5, 1); for (int i = 0; i < 5; i++) { cout << arr[i] << " "; } return 0;} Tags vector Facebook Twitter Whatsapp Newer Older