Search This Blog

Friday, 21 August 2020

Array ex1

 #include<iostream>

using namespace std;

#include<iomanip>

using std::setw;

int main()

{

int n[15],b;                                       //array size is 15

cout<<"enter the table nomber that you have \n"<<endl;

cin>>b;

                                                       //inilise the arry elements in n to o

   for(int i=1;i<=10;i++)

   {

    n[i]=i*b;                                          //twice the element

   }

   cout<<"\t table of  "<<  b<<endl;

                                                       //output each arry elements value

    for(int j=1;j<=10;j++)

    {

    cout<<setw(7)<<b<<"*"<<j<<"="<<setw(7)<<n[j]<<endl;

                                                    //setw is used for formating output

 

}

return 0;

}


No comments:

Post a Comment

Search This Blog

Contact Form

Name

Email *

Message *

Popular Posts