Friday, 15 January 2021

WAP in C++ to read and display a Single Dimensional array.

#include <iostream>

using namespace std;

main()

{

  int N,i;

  cout<<"Enter the size of the array\n";

  cin>>N;

  int arr[N];

  cout<<"Enter "<<N<<" Numbers\n";

  for(i=0;i<N;i++)

  cin>>arr[i];

  cout<<"The elements of the array are:\n";

  for(i=0;i<N;i++)

  cout<<arr[i]<<"\n";

No comments:

Post a Comment

Java Program to count the total number of characters in a string

 //Java Program to count the total number of characters in a string import java.util.*; public class CountChars {     public static void mai...